aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-28 15:38:28 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-28 15:38:38 +0200
commite641585834b3e917273f6e28fc7455ccf60f0e53 (patch)
treeacf7e0335900e91acfb307e263ae2dbc8e639e2c
parentholy crap, it actually kinda works now (diff)
downloadcimple-e641585834b3e917273f6e28fc7455ccf60f0e53.tar.gz
cimple-e641585834b3e917273f6e28fc7455ccf60f0e53.zip
msg: fix a buffer overflow
Thanks, Valgrind!
-rw-r--r--src/msg.c2
1 files changed, 1 insertions, 1 deletions
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;