From 3b51f8ddd5408eaae06e774e40144c7788748000 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Wed, 3 Jun 2015 13:33:26 +0200 Subject: util: fix another cunescape() regression Fix a regression caused by 4034a06d ("util: rework word parsing and c unescaping code") which broke octal escape sequences. The reason for this breakage is that cunescape_one() expects 4 characters in an octal encoding, which is a stray left-over from the old code which operated on different variables to make the length check. While at it, add a test case to prevent the same thing from happening again. --- src/shared/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/shared/util.c') diff --git a/src/shared/util.c b/src/shared/util.c index 8a6107969a..311acbb349 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -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]); -- cgit v1.2.3-54-g00ecf