np = pe - p;
/* Sanity check on locale lengths */
- if (np < 1 || (np == 1 && *p != 'C') || np >= 16) {
+ if (np < 1 || (np == 1 && *p != 'C') || np >= 32) {
rpmError(RPMERR_BADSPEC, _("Unusual locale length: \"%.*s\" in %%lang(%s)"),
- np, p, q);
+ (int)np, p, q);
fl->processingFailed = 1;
return RPMERR_BADSPEC;
}
if (strncmp(fl->currentLangs[i], p, np))
continue;
rpmError(RPMERR_BADSPEC, _("Duplicate locale %.*s in %%lang(%s)"),
- np, p, q);
+ (int)np, p, q);
fl->processingFailed = 1;
return RPMERR_BADSPEC;
}
goto exit;
}
- if (! strncmp(icon, "GIF", 3)) {
+ if (! strncmp(icon, "GIF", sizeof("GIF")-1)) {
headerAddEntry(h, RPMTAG_GIF, RPM_BIN_TYPE, icon, statbuf.st_size);
- } else if (! strncmp(icon, "/* XPM", 6)) {
+ } else if (! strncmp(icon, "/* XPM", sizeof("/* XPM")-1)) {
headerAddEntry(h, RPMTAG_XPM, RPM_BIN_TYPE, icon, statbuf.st_size);
} else {
rpmError(RPMERR_BADSPEC, _("Unknown icon type: %s"), file);
spec->lineNum, spec->line);
return RPMERR_BADSPEC;
}
- } else if (!strncmp(s, "-p", 2)) {
+ } else if (!strncmp(s, "-p", sizeof("-p")-1)) {
/* unfortunately, we must support -pX */
if (! strchr(" \t\n", s[2])) {
s = s + 2;
saveLines = lines;
while (*lines) {
res = 0;
- if (! strncmp(*lines, "%setup", 6)) {
+ if (! strncmp(*lines, "%setup", sizeof("%setup")-1)) {
res = doSetupMacro(spec, *lines);
- } else if (! strncmp(*lines, "%patch", 6)) {
+ } else if (! strncmp(*lines, "%patch", sizeof("%patch")-1)) {
res = doPatchMacro(spec, *lines);
} else {
appendLineStringBuf(spec->prep, *lines);
SKIPSPACE(s);
match = -1;
- if (! strncmp("%ifarch", s, 7)) {
+ if (! strncmp("%ifarch", s, sizeof("%ifarch")-1)) {
s += 7;
match = matchTok(arch, s);
- } else if (! strncmp("%ifnarch", s, 8)) {
+ } else if (! strncmp("%ifnarch", s, sizeof("%ifnarch")-1)) {
s += 8;
match = !matchTok(arch, s);
- } else if (! strncmp("%ifos", s, 5)) {
+ } else if (! strncmp("%ifos", s, sizeof("%ifos")-1)) {
s += 5;
match = matchTok(os, s);
- } else if (! strncmp("%ifnos", s, 6)) {
+ } else if (! strncmp("%ifnos", s, sizeof("%ifnos")-1)) {
s += 6;
match = !matchTok(os, s);
- } else if (! strncmp("%if", s, 3)) {
+ } else if (! strncmp("%if", s, sizeof("%if")-1)) {
s += 3;
match = parseExpressionBoolean(spec, s);
if (match < 0) {
ofi->fileName, ofi->lineNum, match);
return RPMERR_BADSPEC;
}
- } else if (! strncmp("%else", s, 5)) {
+ } else if (! strncmp("%else", s, sizeof("%else")-1)) {
s += 5;
if (! spec->readStack->next) {
/* Got an else with no %if ! */
spec->readStack->reading =
spec->readStack->next->reading && ! spec->readStack->reading;
spec->line[0] = '\0';
- } else if (! strncmp("%endif", s, 6)) {
+ } else if (! strncmp("%endif", s, sizeof("%endif")-1)) {
s += 6;
if (! spec->readStack->next) {
/* Got an end with no %if ! */
spec->readStack = spec->readStack->next;
free(rl);
spec->line[0] = '\0';
- } else if (! strncmp("%include", s, 8)) {
+ } else if (! strncmp("%include", s, sizeof("%include")-1)) {
char *fileName, *endFileName, *p;
s += 8;
if (ourread(cfd, &physHeader, PHYS_HDR_SIZE) != PHYS_HDR_SIZE)
return CPIOERR_READ_FAILED;
- if (strncmp(CPIO_CRC_MAGIC, physHeader.magic, strlen(CPIO_CRC_MAGIC)) &&
- strncmp(CPIO_NEWC_MAGIC, physHeader.magic, strlen(CPIO_NEWC_MAGIC)))
+ if (strncmp(CPIO_CRC_MAGIC, physHeader.magic, sizeof(CPIO_CRC_MAGIC)-1) &&
+ strncmp(CPIO_NEWC_MAGIC, physHeader.magic, sizeof(CPIO_NEWC_MAGIC)-1))
return CPIOERR_BAD_MAGIC;
GET_NUM_FIELD(physHeader.inode, chPtr->inode);
*se++ = '\0';
/* HTTP: look for "HTTP/1.1 123 ..." */
- if (!strncmp(s, "HTTP", 4)) {
+ if (!strncmp(s, "HTTP", sizeof("HTTP")-1)) {
char *e;
if ((e = strchr(s, ' ')) != NULL) {
e++;
/* FTP: look for "123-" and/or "123 " */
if (strchr("0123456789", *s)) {
if (errorCode[0]) {
- if (!strncmp(s, errorCode, 3) && s[3] == ' ')
+ if (!strncmp(s, errorCode, sizeof("123")-1) && s[3] == ' ')
doesContinue = 0;
} else {
- strncpy(errorCode, s, 3);
+ strncpy(errorCode, s, sizeof("123")-1);
errorCode[3] = '\0';
if (s[3] != '-') {
doesContinue = 0;
*tagMatch = NULL;
*extMatch = NULL;
- if (strncmp("RPMTAG_", name, 7)) {
+ if (strncmp("RPMTAG_", name, sizeof("RPMTAG_")-1)) {
tagname = alloca(strlen(name) + 10);
strcpy(tagname, "RPMTAG_");
strcat(tagname, name);
spec->fileCount = 0;
for (strptr = lines; *strptr; strptr++) {
- if (!strncmp("%speci", *strptr, 6)) {
+ if (!strncmp("%speci", *strptr, sizeof("%speci")-1)) {
state = FILELIST;
files = strptr + 1;
- } else if (!strncmp("%postun", *strptr, 7)) {
+ } else if (!strncmp("%postun", *strptr, sizeof("%postun")-1)) {
state = POSTUN;
str = &spec->postun;
}
- else if (!strncmp("%preun", *strptr, 6)) {
+ else if (!strncmp("%preun", *strptr, sizeof("%preun")-1)) {
state = PREUN;
str = &spec->preun;
}
- else if (!strncmp("%post", *strptr, 5)) {
+ else if (!strncmp("%post", *strptr, sizeof("%post")-1)) {
state = POSTIN;
str = &spec->postin;
}
- else if (!strncmp("%pre", *strptr, 4)) {
+ else if (!strncmp("%pre", *strptr, sizeof("%pre")-1)) {
state = PREIN;
str = &spec->prein;
}