commit 6e1d6bccb3a2bc6497c88df19234d01b67463d09d521ff5f79d11d316966124d from: Stefan Sperling date: Sat Apr 11 08:36:05 2026 UTC validate UTF-8 in quoted strings in gotsys.conf test and review/ok Kyle Ackerman commit - 9c50af0ee8deb8c773d10b1a636ed2fe2b13f4c8b5394c379274f620a2cc06b2 commit + 6e1d6bccb3a2bc6497c88df19234d01b67463d09d521ff5f79d11d316966124d blob - 79172a1e9461a26d60a83bc7c45d5986518a8ec65cc8db422978a449150c4a91 blob + a03db6e4d173a8b8290690909418f4b5c8078fd1fbad14168296ca80a5e2d0ce --- gotsys/parse.y +++ gotsys/parse.y @@ -54,6 +54,7 @@ #include "media.h" #include "gotwebd.h" #include "gotsys.h" +#include "utf8d.h" #ifndef nitems #define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) @@ -1392,6 +1393,7 @@ yylex(void) unsigned char *p; int quotec, next, c; int token; + uint32_t cp, state = UTF8_ACCEPT; p = buf; c = lgetc(0); @@ -1438,6 +1440,11 @@ yylex(void) yyerror("string too long"); return (findeol()); } + if (utf8_decode(&state, &cp, + (unsigned char)c) == UTF8_REJECT) { + yyerror("invalid UTF-8 string"); + return (findeol()); + } *p++ = c; } yylval.v.string = strdup(buf);