iconv: fix missing bounds checking for shift_jis decoding
[musl.git] / src / string / strdup.c
blobd4c274494f654e2fe04ce7384431f5dfdb817c03
1 #include <stdlib.h>
2 #include <string.h>
4 char *strdup(const char *s)
6 size_t l = strlen(s);
7 char *d = malloc(l+1);
8 if (!d) return NULL;
9 return memcpy(d, s, l+1);