changeset 39:23b01aa3ecf9

Fixed missing NUL termination in macro expansion
author lost@l-w.ca
date Sat, 02 Apr 2011 02:48:36 -0600
parents 7e92484cfbc3
children d96037ea0b80
files lwasm/macro.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/macro.c	Sat Apr 02 02:19:02 2011 -0600
+++ b/lwasm/macro.c	Sat Apr 02 02:48:36 2011 -0600
@@ -163,7 +163,7 @@
 
 	as -> context = lwasm_next_context(as);
 
-	while (**p && !isspace(**p) && **p != ',')
+	while (**p && !isspace(**p) && **p)
 	{
 		p2 = *p;
 		while (*p2 && !isspace(*p2) && *p2 != ',')
@@ -271,10 +271,10 @@
 		for (p = ctcbuf; *p; p++)
 			macro_add_to_buff(&linebuff, &bloc, &blen, *p);
 	}
+	macro_add_to_buff(&linebuff, &bloc, &blen, 0);
 	
 	// push the macro into the front of the stream
 	input_openstring(as, opc, linebuff);
-
 	lw_free(linebuff);
 
 	// clean up