commit 99eab2d147acfe4e1e16b594023f08b4524bd3db
parent 12e22bb1b4a687def2f36f281456da28ee3a4d95
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date: Fri, 18 Mar 2016 15:21:17 -0400
oops, nul terminate string tokens
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lisc/parse.c b/lisc/parse.c
@@ -266,10 +266,12 @@ lex()
tokval.str = vnew(0, 1);
for (i=0;; i++) {
c = fgetc(inf);
+ vgrow(&tokval.str, i+1);
if (c == '"')
- if (!i || tokval.str[i-1] != '\\')
+ if (!i || tokval.str[i-1] != '\\') {
+ tokval.str[i] = 0;
return TStr;
- vgrow(&tokval.str, i+1);
+ }
tokval.str[i] = c;
}
}