comparison lwasm/macro.c @ 39:23b01aa3ecf9

Fixed missing NUL termination in macro expansion
author lost@l-w.ca
date Sat, 02 Apr 2011 02:48:36 -0600
parents 7317fbe024af
children d96037ea0b80
comparison
equal deleted inserted replaced
38:7e92484cfbc3 39:23b01aa3ecf9
161 161
162 cl = l; 162 cl = l;
163 163
164 as -> context = lwasm_next_context(as); 164 as -> context = lwasm_next_context(as);
165 165
166 while (**p && !isspace(**p) && **p != ',') 166 while (**p && !isspace(**p) && **p)
167 { 167 {
168 p2 = *p; 168 p2 = *p;
169 while (*p2 && !isspace(*p2) && *p2 != ',') 169 while (*p2 && !isspace(*p2) && *p2 != ',')
170 { 170 {
171 if (*p2 == '\\') 171 if (*p2 == '\\')
269 char *p; 269 char *p;
270 snprintf(ctcbuf, 100, "\001\001SETCONTEXT %d\n", oldcontext); 270 snprintf(ctcbuf, 100, "\001\001SETCONTEXT %d\n", oldcontext);
271 for (p = ctcbuf; *p; p++) 271 for (p = ctcbuf; *p; p++)
272 macro_add_to_buff(&linebuff, &bloc, &blen, *p); 272 macro_add_to_buff(&linebuff, &bloc, &blen, *p);
273 } 273 }
274 macro_add_to_buff(&linebuff, &bloc, &blen, 0);
274 275
275 // push the macro into the front of the stream 276 // push the macro into the front of the stream
276 input_openstring(as, opc, linebuff); 277 input_openstring(as, opc, linebuff);
277
278 lw_free(linebuff); 278 lw_free(linebuff);
279 279
280 // clean up 280 // clean up
281 if (args) 281 if (args)
282 { 282 {