Commit 6a526cd8 authored by Mouse's avatar Mouse

@SongShawn found a bug in vasprintf().

parent bc3e93a9
...@@ -151,7 +151,7 @@ vasprintf(char **ret, const char *fmt, va_list args) { ...@@ -151,7 +151,7 @@ vasprintf(char **ret, const char *fmt, va_list args) {
if(suggested >= 0) { if(suggested >= 0) {
*ret = malloc(suggested + 1); *ret = malloc(suggested + 1);
if(*ret) { if(*ret) {
int actual_length = vsnprintf(*ret, suggested + 1, fmt, copy); actual_length = vsnprintf(*ret, suggested + 1, fmt, copy);
if(actual_length >= 0) { if(actual_length >= 0) {
assert(actual_length == suggested); assert(actual_length == suggested);
assert((*ret)[actual_length] == '\0'); assert((*ret)[actual_length] == '\0');
......
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