libobs/util: Make sure to set capacity in dstr_ncopy* funcs
This commit is contained in:
parent
45a2fa0e1a
commit
ae8b4bc538
@ -346,6 +346,7 @@ void dstr_ncopy(struct dstr *dst, const char *array, const size_t len)
|
||||
|
||||
dst->array = bmemdup(array, len + 1);
|
||||
dst->len = len;
|
||||
dst->capacity = len + 1;
|
||||
|
||||
dst->array[len] = 0;
|
||||
}
|
||||
@ -363,6 +364,7 @@ void dstr_ncopy_dstr(struct dstr *dst, const struct dstr *str, const size_t len)
|
||||
newlen = size_min(len, str->len);
|
||||
dst->array = bmemdup(str->array, newlen + 1);
|
||||
dst->len = newlen;
|
||||
dst->capacity = newlen + 1;
|
||||
|
||||
dst->array[newlen] = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user