Fix string termination

This commit is contained in:
Gregory Lirent 2022-06-04 00:31:50 +03:00
parent 72d36ff3a7
commit a42feaf72b

View File

@ -24,6 +24,7 @@ size_t string_replace_cstring_cstring(str_t* x, const char* a, const char* d, si
if (x->buffer == a) {
x->buffer = realloc(x->buffer, dn + 1);
memcpy(x->buffer, d, dn);
x->buffer[dn] = 0;
return 1;
}
@ -68,6 +69,7 @@ size_t string_replace_cstring_char(str_t* x, const char* a, int dc, size_t maxn)
if (x->buffer == a) {
x->buffer = realloc(x->buffer, dn + 1);
memcpy(x->buffer, d, dn);
x->buffer[dn] = 0;
return 1;
} else if (x->buffer < a && a < x->buffer + n) {