Potential unterminated string

This commit is contained in:
Scott Giese
2019-12-15 02:19:13 -06:00
parent c653a82619
commit 1619df97f8
+6 -2
View File
@@ -420,10 +420,14 @@ naRef naParseCode(struct Context* c, naRef srcFile, int firstLine,
// Catch parser errors here. // Catch parser errors here.
p.errLine = *errLine = 1; p.errLine = *errLine = 1;
if(setjmp(p.jumpHandle)) { if (setjmp(p.jumpHandle)) {
strncpy(c->error, p.err, sizeof(c->error)); size_t end_ = sizeof(c->error) - 1;
strncpy(c->error, p.err, end_);
c->error[end_] = '\0';
*errLine = p.errLine; *errLine = p.errLine;
naParseDestroy(&p); naParseDestroy(&p);
return naNil(); return naNil();
} }