shithub: rgbds

Download patch

ref: 02191135a0ed33848e004696f0c5a67a997fec61
parent: a21cef71908be8d93009542a324dceef9c14d855
author: ISSOtm <[email protected]>
date: Fri Aug 30 23:00:26 EDT 2019

Fix possible unterminated string
sym_SetMacroArgID used a `sprintf` that could write no \0.
In practice this was benign because %u cannot print 256 chars,
but better future-proof this.

--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -440,7 +440,7 @@
 {
 	char s[256];
 
-	snprintf(s, sizeof(s), "_%u", nMacroCount);
+	snprintf(s, sizeof(s) - 1, "_%u", nMacroCount);
 	newmacroargs[MAXMACROARGS] = strdup(s);
 }