summaryrefslogtreecommitdiffstats
path: root/Parser/parsetok.c
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/parsetok.c')
-rw-r--r--Parser/parsetok.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Parser/parsetok.c b/Parser/parsetok.c
index ce79ce6..5e7957e 100644
--- a/Parser/parsetok.c
+++ b/Parser/parsetok.c
@@ -168,7 +168,8 @@ parsetok(tok, g, start, err_ret)
int len = tok->inp - tok->buf;
err_ret->text = malloc(len + 1);
if (err_ret->text != NULL) {
- strncpy(err_ret->text, tok->buf, len+1);
+ if (len > 0)
+ strncpy(err_ret->text, tok->buf, len);
err_ret->text[len] = '\0';
}
}