From 583606a2b1e61024c8b8e2ff6b551eb47673182b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 24 Jun 2019 14:36:43 +0200 Subject: [PATCH] StringImpl: Fix possible uninitialized access in StringImpl::create(). If the provided length is 0, there's no need to dereference the const char*. --- AK/StringImpl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AK/StringImpl.cpp b/AK/StringImpl.cpp index 6ccb481075..5e8c6d9090 100644 --- a/AK/StringImpl.cpp +++ b/AK/StringImpl.cpp @@ -76,7 +76,7 @@ RefPtr StringImpl::create(const char* cstring, int length, ShouldCho if (!cstring) return nullptr; - if (!*cstring) + if (!length || !*cstring) return the_empty_stringimpl(); if (should_chomp) {