diff options
author | xhe <xw897002528@gmail.com> | 2018-12-28 07:35:36 +0800 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2019-01-16 02:38:18 +0000 |
commit | b4a77c0066619f15cc17e08b072cfd65f774e44e (patch) | |
tree | 02cea8b8d048ec8f9d89c8db28d7efaff27ae4b4 | |
parent | 1d3a2f3b244405b2202cb4571ba7d054ca0ee661 (diff) | |
download | gettext-tiny-b4a77c0066619f15cc17e08b072cfd65f774e44e.tar.gz |
poparser: charset str should stop at escape chars
as we will pass raw strings directly at the first stage, we may meet an
escaped '\n', e.g. "\\n". because, there's no '\\' in charset strings,
we can use '\\' as a terminator to avoid taking useless parts. useless
parts will cause a unsupported_charset error.
-rw-r--r-- | src/poparser.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/poparser.c b/src/poparser.c index 831efa3..e512db7 100644 --- a/src/poparser.c +++ b/src/poparser.c @@ -52,7 +52,7 @@ static inline enum po_error poparser_feed_hdr(struct po_parser *p, char* msg) { char *x, *y; if (p->first && msg) { if ((x = strstr(msg, "charset="))) { - for (y = x; *y && !isspace(*y); y++); + for (y = x; *y && *y != '\\' && !isspace(*y); y++); if ((uintptr_t)(y-x-7) > sizeof(p->hdr.charset)) return -po_unsupported_charset; |