mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
Fix crash on nul character in string escape sequence
If a dts file contains a string with \ followed by a nul byte - an actual nul in the input file, not the \\0 escape - then the assert() in get_escape_char() will trip, crashing dtc. As far as I can tell, there isn't any valid need for this assert(), so just remove it. Reported-by: Anton Blanchard <anton@samba.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
1ab2205a6f
commit
d728ad59f5
3 changed files with 1 additions and 1 deletions
BIN
tests/nul-in-escape.dts
Normal file
BIN
tests/nul-in-escape.dts
Normal file
Binary file not shown.
|
@ -292,6 +292,7 @@ libfdt_tests () {
|
||||||
|
|
||||||
run_wrap_error_test $DTC division-by-zero.dts
|
run_wrap_error_test $DTC division-by-zero.dts
|
||||||
run_wrap_error_test $DTC bad-octal-literal.dts
|
run_wrap_error_test $DTC bad-octal-literal.dts
|
||||||
|
run_dtc_test -I dts -O dtb nul-in-escape.dts
|
||||||
}
|
}
|
||||||
|
|
||||||
dtc_tests () {
|
dtc_tests () {
|
||||||
|
|
1
util.c
1
util.c
|
@ -152,7 +152,6 @@ char get_escape_char(const char *s, int *i)
|
||||||
int j = *i + 1;
|
int j = *i + 1;
|
||||||
char val;
|
char val;
|
||||||
|
|
||||||
assert(c);
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'a':
|
case 'a':
|
||||||
val = '\a';
|
val = '\a';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue