diff options
author | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-26 13:27:43 +0000 |
---|---|---|
committer | Sean Dewar <seandewar@users.noreply.github.com> | 2022-02-26 14:18:34 +0000 |
commit | f6cc604af2a4d95ec9bcaa5bee705cec2e06d541 (patch) | |
tree | aaddcdda79c238dd2c799ba27ba936670873b566 /src/nvim/api/private/converter.c | |
parent | d0f8f76224f501d919ba6c8a5cd717de76903b34 (diff) | |
download | rneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.tar.gz rneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.tar.bz2 rneovim-f6cc604af2a4d95ec9bcaa5bee705cec2e06d541.zip |
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)
Diffstat (limited to 'src/nvim/api/private/converter.c')
-rw-r--r-- | src/nvim/api/private/converter.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c index 3d4ff202fe..49e3cf7df7 100644 --- a/src/nvim/api/private/converter.c +++ b/src/nvim/api/private/converter.c @@ -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) |