commit 5d8cbca3b331d9f20dc4ee509342988c82e11656 from: Christian Weisgerber date: Wed Sep 29 19:53:08 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 - d683c314c5dae715e5918b3952e8c5870db83648 commit + 5d8cbca3b331d9f20dc4ee509342988c82e11656 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 - ba25a756cb8a903c2e0660038d5c673fbf1c478a blob + e3bc2bfff1f77b22844f2f1c4486b518381c578f --- libexec/got-read-gotconfig/parse.y +++ libexec/got-read-gotconfig/parse.y @@ -600,7 +600,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()); } @@ -640,7 +640,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()); }