support set of non terminated string (with len)
This commit is contained in:
parent
bf2c598f63
commit
90c3473406
1 changed files with 2 additions and 1 deletions
|
|
@ -1052,7 +1052,8 @@ capn_ptr capn_new_string(struct capn_segment *seg, const char *str, ssize_t sz)
|
||||||
p.datasz = 1;
|
p.datasz = 1;
|
||||||
new_object(&p, p.len);
|
new_object(&p, p.len);
|
||||||
if (p.data) {
|
if (p.data) {
|
||||||
memcpy(p.data, str, p.len-1);
|
memcpy(p.data, str, p.len - 1);
|
||||||
|
p.data[p.len - 1] = '\0';
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue