From e641585834b3e917273f6e28fc7455ccf60f0e53 Mon Sep 17 00:00:00 2001
From: Egor Tensin <Egor.Tensin@gmail.com>
Date: Sun, 28 Aug 2022 15:38:28 +0200
Subject: msg: fix a buffer overflow

Thanks, Valgrind!
---
 src/msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/msg.c b/src/msg.c
index c37cfb5..5a7e165 100644
--- a/src/msg.c
+++ b/src/msg.c
@@ -129,7 +129,7 @@ static int argv_unpack(struct msg *msg, const char *src)
 	for (int i = 0; i < msg->argc; ++i) {
 		size_t len = strlen(src);
 
-		msg->argv[i] = malloc(len);
+		msg->argv[i] = malloc(len + 1);
 		if (!msg->argv[i]) {
 			print_errno("malloc");
 			goto free;
-- 
cgit v1.2.3