1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-05 23:51:28 +03:00

Merge pull request #51 from zonque/unquote

util: fix another cunescape() regression



compiled and test-util exited with 0
This commit is contained in:
Harald Hoyer 2015-06-03 15:55:28 +02:00
commit ea344aec10
2 changed files with 4 additions and 1 deletions

View File

@ -1152,7 +1152,7 @@ static int cunescape_one(const char *p, size_t length, char *ret, uint32_t *ret_
int a, b, c;
uint32_t m;
if (length != (size_t) -1 && length < 4)
if (length != (size_t) -1 && length < 3)
return -EINVAL;
a = unoctchar(p[0]);

View File

@ -460,6 +460,9 @@ static void test_cunescape(void) {
assert_se(cunescape("\\u0000", 0, &unescaped) < 0);
assert_se(cunescape("\\u00DF\\U000000df\\u03a0\\U00000041", UNESCAPE_RELAX, &unescaped) >= 0);
assert_se(streq_ptr(unescaped, "ßßΠA"));
assert_se(cunescape("\\073", 0, &unescaped) >= 0);
assert_se(streq_ptr(unescaped, ";"));
}
static void test_foreach_word(void) {