mirror of
https://https.git.savannah.gnu.org/git/patch.git
synced 2026-01-26 16:09:26 +00:00
Don’t be fooled by "\000" in file name
* src/util.c (parse_c_string): Don’t be tricked by perverse C-style quoted strings containing backslash, '0', '0', '0'. * tests/quoted-filenames: Test this.
This commit is contained in:
parent
8492a6a212
commit
79dd5e762c
@ -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;
|
||||
}
|
||||
|
||||
@ -31,3 +31,25 @@ ncheck 'patch -s -p0 < d.diff'
|
||||
check 'cat " "' <<EOF
|
||||
two
|
||||
EOF
|
||||
|
||||
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: $?' <<EOF
|
||||
can't find file to patch at input line 3
|
||||
Perhaps you should have used the -p or --strip option?
|
||||
The text leading up to this was:
|
||||
--------------------------
|
||||
|*** /dev/null Sat Sep 14 08:47:53 2024
|
||||
|--- "f\000g" Tue Sep 17 10:21:17 2024
|
||||
--------------------------
|
||||
No file to patch. Skipping patch.
|
||||
1 out of 1 hunk ignored
|
||||
status: 1
|
||||
EOF
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user