Verified Commit 12ecdf5c authored by A. Wilcox's avatar A. Wilcox

string: check NULL before using src here, too

parent ee849d02
......@@ -64,7 +64,7 @@ alias(__libc_malloc, __malloc);
void *__libc_memalign(size_t align, size_t len)
{
void *result;
void *result = NULL;
if (posix_memalign(&result, align, len) != 0)
return NULL;
return result;
......
......@@ -167,10 +167,11 @@ char *__strcat_chk(char *dest, const char *src, size_t destlen)
*/
char *__strcpy_chk(char *dest, const char *src, size_t destlen)
{
size_t n = strlen(src) + 1;
size_t n;
assert(dest != NULL);
assert(src != NULL);
n = strlen(src) + 1;
assert(destlen >= n);
if (dest < src) {
assert(dest + n <= src);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment