mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix string index for appending
`sizeof(string-literal)` is included `'\0'` character
This commit is contained in:
@@ -5715,9 +5715,9 @@ parser_yylex(parser_state *p)
|
||||
const char hexdigits[] = "0123456789ABCDEF";
|
||||
|
||||
strcpy(buf, s);
|
||||
buf[sizeof(s)] = hexdigits[(c & 0xf0) >> 4];
|
||||
buf[sizeof(s)+1] = hexdigits[(c & 0x0f)];
|
||||
buf[sizeof(s)+2] = 0;
|
||||
buf[sizeof(s)-1] = hexdigits[(c & 0xf0) >> 4];
|
||||
buf[sizeof(s)] = hexdigits[(c & 0x0f)];
|
||||
buf[sizeof(s)+1] = 0;
|
||||
yyerror(p, buf);
|
||||
goto retry;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user