From d9bc96e497a000b8b431d849a2524d9f7f1ea552 Mon Sep 17 00:00:00 2001 From: Jeremy Sowden Date: Fri, 12 Jul 2019 23:28:14 +0100 Subject: [PATCH] strncpy's third argument should be the length of the dest buffer, not the source. --- src/event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/event.c b/src/event.c index 39bf5507..007b10b4 100644 --- a/src/event.c +++ b/src/event.c @@ -1006,9 +1006,9 @@ static void handleClientMessage(XEvent * event) char *command; size_t len; - len = sizeof(event->xclient.data.b) + 1; - command = wmalloc(len); - strncpy(command, event->xclient.data.b, sizeof(event->xclient.data.b)); + len = sizeof(event->xclient.data.b); + command = wmalloc(len + 1); + strncpy(command, event->xclient.data.b, len); if (strncmp(command, "Reconfigure", sizeof("Reconfigure")) == 0) { wwarning(_("Got Reconfigure command")); -- 2.11.4.GIT