StringImpl: Fix possible uninitialized access in StringImpl::create().

If the provided length is 0, there's no need to dereference the const char*.
This commit is contained in:
Andreas Kling 2019-06-24 14:36:43 +02:00
parent 643a43f278
commit 583606a2b1
Notes: sideshowbarker 2024-07-19 13:29:27 +09:00

View File

@ -76,7 +76,7 @@ RefPtr<StringImpl> StringImpl::create(const char* cstring, int length, ShouldCho
if (!cstring)
return nullptr;
if (!*cstring)
if (!length || !*cstring)
return the_empty_stringimpl();
if (should_chomp) {