From 4631348016f474a75af369ebf94b20d9f31d7908 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 25 Apr 2025 14:48:53 +0530 Subject: [PATCH] ... --- kitty/launcher/shlex.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kitty/launcher/shlex.h b/kitty/launcher/shlex.h index c04ad4adb..7b6d13ebb 100644 --- a/kitty/launcher/shlex.h +++ b/kitty/launcher/shlex.h @@ -25,7 +25,10 @@ typedef struct { static bool alloc_shlex_state(ShlexState *s, const char *src, size_t src_sz, bool support_ansi_c_quoting) { - *s = (ShlexState){.src=src, .src_sz=src_sz, .support_ansi_c_quoting=support_ansi_c_quoting, .buf=malloc(src_sz)}; + *s = (ShlexState){ + // for NULL termination and some safety we add 16 bytes + .src=src, .src_sz=src_sz, .support_ansi_c_quoting=support_ansi_c_quoting, .buf=malloc(16 + src_sz) + }; return s->buf != NULL; }