mirror of
https://github.com/tmux/tmux.git
synced 2024-11-18 02:18:53 +00:00
Don't crash with a zero-length argument to setb, from J Raynor.
This commit is contained in:
parent
77603c4f2d
commit
26c42ad1e4
@ -56,6 +56,9 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
pb = NULL;
|
pb = NULL;
|
||||||
buffer = -1;
|
buffer = -1;
|
||||||
|
|
||||||
|
if ((newsize = strlen(args->argv[0])) == 0)
|
||||||
|
return (CMD_RETURN_NORMAL);
|
||||||
|
|
||||||
if (args_has(args, 'b')) {
|
if (args_has(args, 'b')) {
|
||||||
buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);
|
buffer = args_strtonum(args, 'b', 0, INT_MAX, &cause);
|
||||||
if (cause != NULL) {
|
if (cause != NULL) {
|
||||||
@ -80,8 +83,6 @@ cmd_set_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
memcpy(pdata, pb->data, psize);
|
memcpy(pdata, pb->data, psize);
|
||||||
}
|
}
|
||||||
|
|
||||||
newsize = strlen(args->argv[0]);
|
|
||||||
|
|
||||||
pdata = xrealloc(pdata, 1, psize + newsize);
|
pdata = xrealloc(pdata, 1, psize + newsize);
|
||||||
memcpy(pdata + psize, args->argv[0], newsize);
|
memcpy(pdata + psize, args->argv[0], newsize);
|
||||||
psize += newsize;
|
psize += newsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user