summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2020-01-04 00:48:52 +0000
committerKatolaZ <katolaz@freaknet.org>2020-01-04 00:48:52 +0000
commit171b4c872cde8fea8cd6ddc0bc5df3e3bb5c3dcb (patch)
treec5555e0d638d8e73017f4d61344cf35011b8efa0
parent5cb461a629973380fc58050bee2d8d893db7923d (diff)
fix buffer overflow
-rw-r--r--xml2tsv.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/xml2tsv.c b/xml2tsv.c
index ddfa22a..dbd0d9a 100644
--- a/xml2tsv.c
+++ b/xml2tsv.c
@@ -32,7 +32,7 @@ int stack_push(tstack_t *t, const char *c){
if (t->top < DEPTH_MAX){
t->top ++;
strncpy(t->st[t->top], c, STR_MAX - 1);
- *(t->st[t->top] + STR_MAX) = '\0';
+ t->st[t->top][STR_MAX - 1] = '\0';
return 0;
}
return -1;
@@ -98,7 +98,7 @@ void
xmlattrentity(XMLParser *x, const char *t, size_t tl, const char *a, size_t al,
const char *v, size_t vl)
{
- char buf[16];
+ static char buf[16];
int n;
if ((n = xml_entitytostr(v, buf, sizeof(buf))) > 0)