| Summary: | replace strlcpy with memcpy in SDL_strdup() | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ozkan Sezer <sezeroz> |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | All | ||
Fixed, thanks! https://hg.libsdl.org/SDL/rev/68864895c386 |
The following patch replaces SDL_strlcpy() with SDL_memcpy() in SDL_strdup(), which should be more efficient. diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c --- a/src/stdlib/SDL_string.c +++ b/src/stdlib/SDL_string.c @@ -564,7 +564,7 @@ SDL_strdup(const char *string) size_t len = SDL_strlen(string) + 1; char *newstr = SDL_malloc(len); if (newstr) { - SDL_strlcpy(newstr, string, len); + SDL_memcpy(newstr, string, len); } return newstr; }