This commit is contained in:
2022-01-08 22:44:54 +08:00
parent 44c7d3b589
commit 0a9e149e66
6 changed files with 133 additions and 3 deletions

View File

@@ -117,7 +117,7 @@ int cstr_read_str(char* buf, char** dest, size_t* pos, size_t buf_len) {
tmp[n] = 0;
}
*pos = p >= buf_len ? p : p + 1;
char* ntmp = realloc(tmp, n);
char* ntmp = realloc(tmp, n + 1);
*dest = ntmp ? ntmp : tmp;
return 0;
}