Fix bug in DohNewStringWithSize(): guarantee string is nul-terminated
This commit is contained in:
parent
22be94d207
commit
6612997b63
1 changed files with 1 additions and 0 deletions
|
|
@ -1114,6 +1114,7 @@ DOHString *DohNewStringWithSize(const DOHString_or_char *so, int len) {
|
||||||
str->maxsize = max;
|
str->maxsize = max;
|
||||||
if (s) {
|
if (s) {
|
||||||
strncpy(str->str, s, len);
|
strncpy(str->str, s, len);
|
||||||
|
str->str[l] = 0;
|
||||||
str->len = l;
|
str->len = l;
|
||||||
str->sp = l;
|
str->sp = l;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue