diff options
author | Mark Wielaard <mjw@redhat.com> | 2024-04-09 21:11:02 +0200 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2024-04-09 21:11:07 +0200 |
commit | fbc4b11da543753b3b803e5546f56e26ec90c2a7 (patch) | |
tree | 15dd820facfa1f465f20ee54c2ec9e03660591b8 /bzip2.c | |
parent | 9de658d248f9fd304afa3321dd7a9de1280356ec (diff) | |
download | bzip2-master.tar.gz bzip2-master.tar.bz2 bzip2-master.zip |
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
Diffstat (limited to 'bzip2.c')
-rw-r--r-- | bzip2.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1767,8 +1767,8 @@ void addFlagsFromEnvVar ( Cell** argList, Char* varName ) | |||
1767 | if (p[i] == 0) break; | 1767 | if (p[i] == 0) break; |
1768 | p += i; | 1768 | p += i; |
1769 | i = 0; | 1769 | i = 0; |
1770 | while (isspace((Int32)(p[0]))) p++; | 1770 | while (isspace((UChar)(p[0]))) p++; |
1771 | while (p[i] != 0 && !isspace((Int32)(p[i]))) i++; | 1771 | while (p[i] != 0 && !isspace((UChar)(p[i]))) i++; |
1772 | if (i > 0) { | 1772 | if (i > 0) { |
1773 | k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10; | 1773 | k = i; if (k > FILE_NAME_LEN-10) k = FILE_NAME_LEN-10; |
1774 | for (j = 0; j < k; j++) tmpName[j] = p[j]; | 1774 | for (j = 0; j < k; j++) tmpName[j] = p[j]; |