ss_strndup will fail if insufficient memory was available

This commit is contained in:
Yuxiang Zhu
2016-11-16 10:26:25 +08:00
parent dbf00467e0
commit 78b7afb9ac
+1 -1
View File
@@ -177,7 +177,7 @@ ss_strndup(const char *s, size_t n)
return strdup(s);
}
ret = malloc(n + 1);
ret = ss_malloc(n + 1);
strncpy(ret, s, n);
ret[n] = '\0';
return ret;