commit ccd081e7f1f2b65ac6191c78813dcd622b559dd0 from: Christian Weisgerber via: Thomas Adam date: Thu Sep 30 20:53:21 2021 UTC pull in a type fix from the OpenBSD parse.y template Original commit message by deraadt: (unsigned) means (unsigned int) which on ptrdiff_t or size_t or other larger types really is a range reduction... Almost any cast to (unsigned) is a bug. commit - d7a84292effc482dbe4e4b5ade0b231e3b0f6e73 commit + ccd081e7f1f2b65ac6191c78813dcd622b559dd0 blob - 45c6564b67e895dac85cd19bbe0ec58b27e5939d blob + d07e4ee7857c9b384f7deffb440aca3e6aab746c --- gotweb/parse.y +++ gotweb/parse.y @@ -432,7 +432,7 @@ top: if (c == '-' || isdigit(c)) { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); } @@ -471,7 +471,7 @@ nodigits: if (isalnum(c) || c == ':' || c == '_') { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); } blob - 1299aa1f1d93a028f300b2553a699411d6083401 blob + 65ef806773cce10c7696d828bfb623e663957131 --- libexec/got-read-gotconfig/parse.y +++ libexec/got-read-gotconfig/parse.y @@ -601,7 +601,7 @@ top: if (c == '-' || isdigit(c)) { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); } @@ -641,7 +641,7 @@ nodigits: if (isalnum(c) || c == ':' || c == '_') { do { *p++ = c; - if ((unsigned)(p-buf) >= sizeof(buf)) { + if ((size_t)(p-buf) >= sizeof(buf)) { yyerror("string too long"); return (findeol()); }