commit 0c82d2673963812bc99130161de856f2aaf48612 from: Christian Weisgerber date: Fri Oct 15 15:18:30 2021 UTC sync with OpenBSD parse.y Explicitly cast "char" to "unsigned char" when assigned to "int" to prevent sign extension from breaking comparions against EOF or passing invalid arguments to ctype functions. commit - a319ca8c90cbd4f20325a9b71d685a7cca36da9d commit + 0c82d2673963812bc99130161de856f2aaf48612 blob - d07e4ee7857c9b384f7deffb440aca3e6aab746c blob + 1d91c1f05c748a155769cbfd96cb8871ffd0c8cc --- gotweb/parse.y +++ gotweb/parse.y @@ -380,7 +380,7 @@ top: p = val + strlen(val) - 1; lungetc(DONE_EXPAND); while (p >= val) { - lungetc(*p); + lungetc((unsigned char)*p); p--; } lungetc(START_EXPAND); @@ -455,8 +455,8 @@ top: } else { nodigits: while (p > buf + 1) - lungetc(*--p); - c = *--p; + lungetc((unsigned char)*--p); + c = (unsigned char)*--p; if (c == '-') return (c); } blob - e3bc2bfff1f77b22844f2f1c4486b518381c578f blob + 1c790b2db1b1ff2264cbe8535dda3cd449e7753f --- libexec/got-read-gotconfig/parse.y +++ libexec/got-read-gotconfig/parse.y @@ -546,7 +546,7 @@ top: p = val + strlen(val) - 1; lungetc(DONE_EXPAND); while (p >= val) { - lungetc(*p); + lungetc((unsigned char)*p); p--; } lungetc(START_EXPAND); @@ -624,8 +624,8 @@ top: } else { nodigits: while (p > buf + 1) - lungetc(*--p); - c = *--p; + lungetc((unsigned char)*--p); + c = (unsigned char)*--p; if (c == '-') return (c); }