Fix string termination
This commit is contained in:
parent
72d36ff3a7
commit
a42feaf72b
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user