diff options
| author | 2014-10-08 17:35:58 +0000 | |
|---|---|---|
| committer | 2014-10-08 17:35:58 +0000 | |
| commit | 64cf113cfda174a3f12284d623b95b76b54db679 (patch) | |
| tree | f03be81fb0b9ec2b0468ad2d40689ed61b83a2c5 /usr.bin/tmux/window-copy.c | |
| parent | Use xrealloc(NULL, n, m) instead of xmalloc(n * m) to get overflow (diff) | |
| download | wireguard-openbsd-64cf113cfda174a3f12284d623b95b76b54db679.tar.xz wireguard-openbsd-64cf113cfda174a3f12284d623b95b76b54db679.zip | |
Add xreallocarray and remove nmemb argument from xrealloc.
Diffstat (limited to 'usr.bin/tmux/window-copy.c')
| -rw-r--r-- | usr.bin/tmux/window-copy.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/tmux/window-copy.c b/usr.bin/tmux/window-copy.c index bc650e9a399..b0b9e5acd59 100644 --- a/usr.bin/tmux/window-copy.c +++ b/usr.bin/tmux/window-copy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window-copy.c,v 1.115 2014/10/02 08:36:26 nicm Exp $ */ +/* $OpenBSD: window-copy.c,v 1.116 2014/10/08 17:35:58 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -794,7 +794,7 @@ window_copy_key_input(struct window_pane *wp, int key) } inputlen = strlen(data->inputstr); - data->inputstr = xrealloc(data->inputstr, 1, inputlen + n + 1); + data->inputstr = xrealloc(data->inputstr, inputlen + n + 1); memcpy(data->inputstr + inputlen, pb->data, n); data->inputstr[inputlen + n] = '\0'; break; @@ -840,7 +840,7 @@ window_copy_key_input(struct window_pane *wp, int key) break; inputlen = strlen(data->inputstr) + 2; - data->inputstr = xrealloc(data->inputstr, 1, inputlen); + data->inputstr = xrealloc(data->inputstr, inputlen); data->inputstr[inputlen - 2] = key; data->inputstr[inputlen - 1] = '\0'; break; @@ -1533,7 +1533,7 @@ window_copy_append_selection(struct window_pane *wp, const char *bufname) } else pb = paste_get_name(bufname); if (pb != NULL) { - buf = xrealloc(buf, 1, len + pb->size); + buf = xrealloc(buf, len + pb->size); memmove(buf + pb->size, buf, len); memcpy(buf, pb->data, pb->size); len += pb->size; @@ -1589,7 +1589,7 @@ window_copy_copy_line(struct window_pane *wp, } } - *buf = xrealloc(*buf, 1, (*off) + ud.size); + *buf = xrealloc(*buf, (*off) + ud.size); memcpy(*buf + *off, ud.data, ud.size); *off += ud.size; } @@ -1597,7 +1597,7 @@ window_copy_copy_line(struct window_pane *wp, /* Only add a newline if the line wasn't wrapped. */ if (!wrapped || ex != xx) { - *buf = xrealloc(*buf, 1, (*off) + 1); + *buf = xrealloc(*buf, (*off) + 1); (*buf)[(*off)++] = '\n'; } } |
