summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authornicm <nicm>2017-12-18 22:13:36 +0000
committernicm <nicm>2017-12-18 22:13:36 +0000
commit62144b9f57ea981ca2c35fe3466945b8234eba64 (patch)
treef2df7cd3d76fb80bd049d92a22f7436f3422547e /client.c
parent58f6456af7a49db69cf84f538e03c4161a1188d6 (diff)
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.
Diffstat (limited to 'client.c')
-rw-r--r--client.c4
1 files changed, 4 insertions, 0 deletions
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. */