diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -34,8 +34,10 @@ char *stringcopy(const char *s, int len) { r = malloc(len + 1); if (!r) debug(DBG_ERR, "stringcopy: malloc failed"); - memcpy(r, s, len); - r[len] = '\0'; + else { + memcpy(r, s, len); + r[len] = '\0'; + } return r; } |