commit bb27d0d133cd61dc95e337e9d53e611557532338 from: Christian Weisgerber via: Thomas Adam date: Fri Oct 15 19:22:03 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 - d0772de93054323964834281205f7fd52818338d commit + bb27d0d133cd61dc95e337e9d53e611557532338 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 - 65ef806773cce10c7696d828bfb623e663957131 blob + deabda5d8aec84464b9d75cbacf2ae77e665af58 --- libexec/got-read-gotconfig/parse.y +++ libexec/got-read-gotconfig/parse.y @@ -547,7 +547,7 @@ top: p = val + strlen(val) - 1; lungetc(DONE_EXPAND); while (p >= val) { - lungetc(*p); + lungetc((unsigned char)*p); p--; } lungetc(START_EXPAND); @@ -625,8 +625,8 @@ top: } else { nodigits: while (p > buf + 1) - lungetc(*--p); - c = *--p; + lungetc((unsigned char)*--p); + c = (unsigned char)*--p; if (c == '-') return (c); }