mirror of
git://sourceware.org/git/bzip2.git
synced 2024-11-23 11:43:28 +08:00
Make sure to call isdigit and isspace with unsigned char
Casting to Int32 or int could create negative values. Which isspace and isdigit don't handle. SEI CERT C Coding Standard STR37-C. Resolve by casting to UChar or unsigned char instead of Int32 or int. https://sourceware.org/bugzilla/show_bug.cgi?id=28283
This commit is contained in:
parent
9de658d248
commit
fbc4b11da5
4
bzip2.c
4
bzip2.c
@ -1767,8 +1767,8 @@ void addFlagsFromEnvVar ( Cell** argList, Char* varName )
|
|||||||
if (p[i] == 0) break;
|
if (p[i] == 0) break;
|
||||||
p += i;
|
p += i;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (isspace((Int32)(p[0]))) p++;
|
while (isspace((UChar)(p[0]))) p++;
|
||||||
while (p[i] != 0 && !isspace((Int32)(p[i]))) i++;
|
while (p[i] != 0 && !isspace((UChar)(p[i]))) i++;
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10;
|
k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10;
|
||||||
for (j = 0; j < k; j++) tmpName[j] = p[j];
|
for (j = 0; j < k; j++) tmpName[j] = p[j];
|
||||||
|
Loading…
Reference in New Issue
Block a user