From 62144b9f57ea981ca2c35fe3466945b8234eba64 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 18 Dec 2017 22:13:36 +0000 Subject: [PATCH] Do not try to put more in command message than will fit when sending (the server will treat as a fatal error). GitHub issue 1200. --- client.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client.c b/client.c index 743ed33a..0a5abf32 100644 --- a/client.c +++ b/client.c @@ -337,6 +337,10 @@ client_main(struct event_base *base, int argc, char **argv, int flags) size = 0; for (i = 0; i < argc; i++) size += strlen(argv[i]) + 1; + if (size > MAX_IMSGSIZE - (sizeof *data)) { + fprintf(stderr, "command too long\n"); + return (1); + } data = xmalloc((sizeof *data) + size); /* Prepare command for server. */