fix(api): convert blob to NUL-terminated API string

Looks like I did an oopsie; although API strings carry a size field, they should
still be usable as C-strings! (even though they may contain embedded NULs)
This commit is contained in:
Sean Dewar
2022-02-26 13:27:43 +00:00
parent d0f8f76224
commit f6cc604af2
2 changed files with 8 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ typedef struct {
const size_t len_ = (size_t)(len); \
const blob_T *const blob_ = (blob); \
kvi_push(edata->stack, STRING_OBJ(((String) { \
.data = len_ != 0 ? xmemdup(blob_->bv_ga.ga_data, len_) : NULL, \
.data = len_ != 0 ? xmemdupz(blob_->bv_ga.ga_data, len_) : xstrdup(""), \
.size = len_ \
}))); \
} while (0)