diff --git a/src/util.c b/src/util.c index 762a956..a650b9e 100644 --- a/src/util.c +++ b/src/util.c @@ -1439,6 +1439,8 @@ parse_c_string (char const *str, char const **endp) if (c < '0' || c > '7') goto fail; acc |= (c - '0'); + if (!acc) + goto fail; c = acc; break; } diff --git a/tests/quoted-filenames b/tests/quoted-filenames index 0e23e07..ec1d376 100644 --- a/tests/quoted-filenames +++ b/tests/quoted-filenames @@ -31,3 +31,25 @@ ncheck 'patch -s -p0 < d.diff' check 'cat " "' < e.diff <<\EOF +*** /dev/null Sat Sep 14 08:47:53 2024 +--- "f\000g" Tue Sep 17 10:21:17 2024 +*************** +*** 0 **** +--- 1 ---- ++ +EOF + +check 'patch -f < e.diff; echo status: $?' <