mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 13:16:32 +00:00
Berry string literals containing NULL are truncated (#23312)
This commit is contained in:
parent
c2628c95f3
commit
082170374c
@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Berry `bytes().asstring()` now truncates a string if buffer contains NULL
|
- Berry `bytes().asstring()` now truncates a string if buffer contains NULL
|
||||||
|
- Berry string literals containing NULL are truncated
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -284,7 +284,8 @@ static void tr_string(blexer *lexer)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lexer->buf.len = dst - lexbuf(lexer);
|
size_t len = dst - lexbuf(lexer);
|
||||||
|
lexer->buf.len = strnlen(lexbuf(lexer), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int skip_newline(blexer *lexer)
|
static int skip_newline(blexer *lexer)
|
||||||
|
@ -84,3 +84,6 @@ var malformed_numbers = [
|
|||||||
for i : malformed_numbers
|
for i : malformed_numbers
|
||||||
test_source(i, 'malformed number')
|
test_source(i, 'malformed number')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#- ensure that string literal with NULL character is truncated -#
|
||||||
|
assert(size('aa\000bb\000cc') == 2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user