aboutsummaryrefslogtreecommitdiff
path: root/bzlib.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2024-04-09 21:11:02 +0200
committerMark Wielaard <mjw@redhat.com>2024-04-09 21:11:07 +0200
commitfbc4b11da543753b3b803e5546f56e26ec90c2a7 (patch)
tree15dd820facfa1f465f20ee54c2ec9e03660591b8 /bzlib.c
parent9de658d248f9fd304afa3321dd7a9de1280356ec (diff)
downloadbzip2-master.tar.gz
bzip2-master.tar.bz2
bzip2-master.zip
Make sure to call isdigit and isspace with unsigned charHEADmaster
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 'bzlib.c')
-rw-r--r--bzlib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bzlib.c b/bzlib.c
index 2178655..100873c 100644
--- a/bzlib.c
+++ b/bzlib.c
@@ -1408,7 +1408,7 @@ BZFILE * bzopen_or_bzdopen
1408 case 's': 1408 case 's':
1409 smallMode = 1; break; 1409 smallMode = 1; break;
1410 default: 1410 default:
1411 if (isdigit((int)(*mode))) { 1411 if (isdigit((unsigned char)(*mode))) {
1412 blockSize100k = *mode-BZ_HDR_0; 1412 blockSize100k = *mode-BZ_HDR_0;
1413 } 1413 }
1414 } 1414 }