mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-28 03:33:42 +00:00
ss_strndup will fail if insufficient memory was available
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user