projects
/
mit-scheme.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
66f6a88
)
Convert char to unsigned char before using islower/toupper.
author
Taylor R Campbell
<campbell@mumble.net>
Sun, 16 Dec 2018 01:11:58 +0000
(
01:11
+0000)
committer
Taylor R Campbell
<campbell@mumble.net>
Sun, 16 Dec 2018 01:11:58 +0000
(
01:11
+0000)
Failure to do so is undefined behaviour for any negative char values.
src/microcode/findprim.c
patch
|
blob
|
history
diff --git
a/src/microcode/findprim.c
b/src/microcode/findprim.c
index f85f5e23277c1265b8082deeee3fdeeafc70ce01..93eb3c162ca8852e39332206de939caf18726e96 100644
(file)
--- a/
src/microcode/findprim.c
+++ b/
src/microcode/findprim.c
@@
-1206,8
+1206,8
@@
strcmp_ci (const char * s1, const char * s2)
while ((length--) > 0)
{
- int c1 = (
*s1++
);
- int c2 = (
*s2++
);
+ int c1 = (
(unsigned char) (*s1++)
);
+ int c2 = (
(unsigned char) (*s2++)
);
if (islower (c1)) c1 = (toupper (c1));
if (islower (c2)) c2 = (toupper (c2));
if (c1 < c2) return (-1);