diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-03 11:48:41 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-03 11:49:23 +0100 |
commit | ab56f36bfbc7d9de811110cdfa5e2f0c324fbbbb (patch) | |
tree | e76424181b9e5db668383d3f8a41ca84e86afbce /LibC | |
parent | 9da9cce4f75481730859b31f35dbc99bc7738b15 (diff) | |
download | serenity-ab56f36bfbc7d9de811110cdfa5e2f0c324fbbbb.zip |
LibC: strdup() forgot to allocate space for the null character.
Diffstat (limited to 'LibC')
-rw-r--r-- | LibC/string.cpp | 2 |
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; } |