mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Don't return empty StringImpl from create() when char* starts with \0
When creating a StringImpl for a C string that starts with a null-byte, we would ignore the explicitly given length and return the empty StringImpl - presumably to check for "\0", but this leads to false positives ("\0foo") so let's only care about the length.
This commit is contained in:
parent
4e68f179d6
commit
5dcd1c2709
Notes:
sideshowbarker
2024-07-19 01:16:08 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/5dcd1c27097 Pull-request: https://github.com/SerenityOS/serenity/pull/4165
1 changed files with 0 additions and 3 deletions
|
@ -103,9 +103,6 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, size_t length, Should
|
|||
if (!cstring)
|
||||
return nullptr;
|
||||
|
||||
if (!length || !*cstring)
|
||||
return the_empty_stringimpl();
|
||||
|
||||
if (should_chomp) {
|
||||
while (length) {
|
||||
char last_ch = cstring[length - 1];
|
||||
|
|
Loading…
Reference in a new issue