mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibC: strdup() forgot to allocate space for the null character.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user