From 8ebac1f9a681ce1c6287e7c6a1b3093b00fb0c5a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 10 Apr 2015 11:56:04 +0200 Subject: util: fix unicode decoding in unquote_first_word() --- src/shared/util.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/shared') diff --git a/src/shared/util.c b/src/shared/util.c index 2385224fbb..61f3090e20 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -7284,7 +7284,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { return -EINVAL; } - if (!GREEDY_REALLOC(s, allocated, sz+2)) + if (!GREEDY_REALLOC(s, allocated, sz+7)) return -ENOMEM; if (flags & UNQUOTE_CUNESCAPE) { @@ -7299,7 +7299,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { if (c != 0) s[sz++] = c; /* normal explicit char */ else - sz += utf8_encode_unichar(s, u); /* unicode chars we'll encode as utf8 */ + sz += utf8_encode_unichar(s + sz, u); /* unicode chars we'll encode as utf8 */ } else s[sz++] = c; @@ -7331,7 +7331,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { return -EINVAL; } - if (!GREEDY_REALLOC(s, allocated, sz+2)) + if (!GREEDY_REALLOC(s, allocated, sz+7)) return -ENOMEM; if (flags & UNQUOTE_CUNESCAPE) { @@ -7346,7 +7346,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { if (c != 0) s[sz++] = c; else - sz += utf8_encode_unichar(s, u); + sz += utf8_encode_unichar(s + sz, u); } else s[sz++] = c; @@ -7376,7 +7376,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { return -EINVAL; } - if (!GREEDY_REALLOC(s, allocated, sz+2)) + if (!GREEDY_REALLOC(s, allocated, sz+7)) return -ENOMEM; if (flags & UNQUOTE_CUNESCAPE) { @@ -7391,7 +7391,7 @@ int unquote_first_word(const char **p, char **ret, UnquoteFlags flags) { if (c != 0) s[sz++] = c; else - sz += utf8_encode_unichar(s, u); + sz += utf8_encode_unichar(s + sz, u); } else s[sz++] = c; -- cgit v1.2.3-54-g00ecf