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.
pull/1184/merge
nicm 2017-12-18 22:13:36 +00:00
parent 58f6456af7
commit 62144b9f57
1 changed files with 4 additions and 0 deletions

View File

@ -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. */