summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxhe <xw897002528@gmail.com>2018-12-16 15:07:20 +0800
committerrofl0r <retnyg@gmx.net>2019-01-16 02:38:18 +0000
commit57f5590bb624693a07bf50300b09e17af041c527 (patch)
tree08b230e4d48c736ac34e7f23c4852372400c6bf7
parentc4075b1f5d5a503f2063c130d3348dc94663ff1e (diff)
downloadgettext-tiny-57f5590bb624693a07bf50300b09e17af041c527.tar.gz
poparser: avoid memory corruption by terminator
we did not add NULL terminator into the length of strings.
-rw-r--r--src/poparser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/poparser.c b/src/poparser.c
index 75f2b0f..7f87776 100644
--- a/src/poparser.c
+++ b/src/poparser.c
@@ -56,7 +56,7 @@ static inline enum po_error poparser_feed_hdr(struct po_parser *p, po_message_t
if ((x = strstr(msg->str[0], "charset="))) {
for (y = x; *y && !isspace(*y); y++);
- if ((y-x-8) > sizeof(p->hdr.charset))
+ if ((unsigned)(y-x-7) > sizeof(p->hdr.charset))
return -po_unsupported_charset;
memcpy(p->hdr.charset, x+8, y-x-8);