From f6cc604af2a4d95ec9bcaa5bee705cec2e06d541 Mon Sep 17 00:00:00 2001 From: Sean Dewar Date: Sat, 26 Feb 2022 13:27:43 +0000 Subject: 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) --- src/nvim/api/private/converter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') 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) -- cgit