Fix signed/unsigned mix comparisons involving sizeof.
This commit is contained in:
parent
4edd10842c
commit
cee22cbd29
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114469
@ -188,7 +188,7 @@ rd_nm(ARCHD *arcn, int nsz)
|
||||
/*
|
||||
* do not even try bogus values
|
||||
*/
|
||||
if ((nsz == 0) || (nsz > sizeof(arcn->name))) {
|
||||
if ((nsz == 0) || (nsz > (int)sizeof(arcn->name))) {
|
||||
paxwarn(1, "Cpio file name length %d is out of range", nsz);
|
||||
return(-1);
|
||||
}
|
||||
@ -266,7 +266,7 @@ rd_ln_nm(ARCHD *arcn)
|
||||
int
|
||||
cpio_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_CPIO)) ||
|
||||
if ((size < (int)sizeof(HD_CPIO)) ||
|
||||
(strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
@ -522,7 +522,7 @@ cpio_wr(ARCHD *arcn)
|
||||
int
|
||||
vcpio_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
if ((size < (int)sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
@ -539,8 +539,8 @@ vcpio_id(char *blk, int size)
|
||||
int
|
||||
crc_id(char *blk, int size)
|
||||
{
|
||||
if ((size < sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0))
|
||||
if ((size < (int)sizeof(HD_VCPIO)) ||
|
||||
(strncmp(blk, AVCMAGIC, (int)sizeof(AVCMAGIC) - 1) != 0))
|
||||
return(-1);
|
||||
return(0);
|
||||
}
|
||||
@ -860,7 +860,7 @@ vcpio_wr(ARCHD *arcn)
|
||||
int
|
||||
bcpio_id(char *blk, int size)
|
||||
{
|
||||
if (size < sizeof(HD_BCPIO))
|
||||
if (size < (int)sizeof(HD_BCPIO))
|
||||
return(-1);
|
||||
|
||||
/*
|
||||
|
@ -188,7 +188,7 @@ static void
|
||||
pax_options(int argc, char **argv)
|
||||
{
|
||||
int c;
|
||||
int i;
|
||||
size_t i;
|
||||
unsigned int flg = 0;
|
||||
unsigned int bflg = 0;
|
||||
char *pt;
|
||||
@ -1017,7 +1017,8 @@ mkpath(path)
|
||||
static void
|
||||
cpio_options(int argc, char **argv)
|
||||
{
|
||||
int c, i;
|
||||
int c;
|
||||
size_t i;
|
||||
char *str;
|
||||
FSUB tmp;
|
||||
FILE *fp;
|
||||
|
@ -537,7 +537,7 @@ tar_wr(ARCHD *arcn)
|
||||
case PAX_SLK:
|
||||
case PAX_HLK:
|
||||
case PAX_HRG:
|
||||
if (arcn->ln_nlen > sizeof(hd->linkname)) {
|
||||
if (arcn->ln_nlen > (int)sizeof(hd->linkname)) {
|
||||
paxwarn(1,"Link name too long for tar %s", arcn->ln_name);
|
||||
return(1);
|
||||
}
|
||||
@ -554,7 +554,7 @@ tar_wr(ARCHD *arcn)
|
||||
len = arcn->nlen;
|
||||
if (arcn->type == PAX_DIR)
|
||||
++len;
|
||||
if (len >= sizeof(hd->name)) {
|
||||
if (len >= (int)sizeof(hd->name)) {
|
||||
paxwarn(1, "File name too long for tar %s", arcn->name);
|
||||
return(1);
|
||||
}
|
||||
@ -903,7 +903,8 @@ ustar_wr(ARCHD *arcn)
|
||||
* check the length of the linkname
|
||||
*/
|
||||
if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) ||
|
||||
(arcn->type == PAX_HRG)) && (arcn->ln_nlen >= sizeof(hd->linkname))){
|
||||
(arcn->type == PAX_HRG)) &&
|
||||
(arcn->ln_nlen >= (int)sizeof(hd->linkname))) {
|
||||
paxwarn(1, "Link name too long for ustar %s", arcn->ln_name);
|
||||
return(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user