summaryrefslogtreecommitdiff
path: root/LibC
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-03 11:48:41 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-03 11:49:23 +0100
commitab56f36bfbc7d9de811110cdfa5e2f0c324fbbbb (patch)
treee76424181b9e5db668383d3f8a41ca84e86afbce /LibC
parent9da9cce4f75481730859b31f35dbc99bc7738b15 (diff)
downloadserenity-ab56f36bfbc7d9de811110cdfa5e2f0c324fbbbb.zip
LibC: strdup() forgot to allocate space for the null character.
Diffstat (limited to 'LibC')
-rw-r--r--LibC/string.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/LibC/string.cpp b/LibC/string.cpp
index 79d425dc4f..02d8d934ea 100644
--- a/LibC/string.cpp
+++ b/LibC/string.cpp
@@ -55,7 +55,7 @@ size_t strlen(const char* str)
char* strdup(const char* str)
{
size_t len = strlen(str);
- char* new_str = (char*)malloc(len);
+ char* new_str = (char*)malloc(len + 1);
strcpy(new_str, str);
return new_str;
}