mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibC: strdup() forgot to allocate space for the null character.
This commit is contained in:
parent
9da9cce4f7
commit
ab56f36bfb
Notes:
sideshowbarker
2024-07-19 15:52:58 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ab56f36bfbc
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue