mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-18 22:47:04 -04:00
libobs/util: Make sure to set capacity in dstr_ncopy* funcs
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user