shithub: rgbds

Download patch

ref: b3120aea25b78ebb2e025f8a4ffebbebf473a251
parent: 3cd1d46a1bf66df5fafe04dde885cc6f3dfcdb28
author: dbrotz <43593771+dbrotz@users.noreply.github.com>
date: Wed Jun 26 13:45:49 EDT 2019

Terminate standalone bracketed symbol strings

Standalone bracketed symbols like the following weren't being zero-terminated.

X EQUS {Y}

This doesn't apply to bracketed symbols that aren't standalone, but are
instead found in a string. For example, the following works even without this
fix.

X EQUS "{Y}"

--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -731,7 +731,9 @@
 			return T_STRING;
 		} else if (*pLexBuffer == '{') {
 			pLexBuffer++;
-			yylex_ReadBracketedSymbol(yylval.tzString, 0);
+			size_t len = yylex_ReadBracketedSymbol(yylval.tzString,
+							       0);
+			yylval.tzString[len] = 0;
 			return T_STRING;
 		}