diff options
author | nicm <nicm> | 2020-10-29 16:33:01 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-10-30 12:09:52 +0000 |
commit | d0ad34e94d63def5178f02281637d2d15cb42c88 (patch) | |
tree | cf34b8ffee28549423fa0a3558effba509a7b85e | |
parent | a10c4c60cb08a0e13e8c65b81a5c1328b1d4788d (diff) |
Do not write after the end of the array and overwrite the stack when
colon-separated SGR sequences contain empty arguments. Reported by Sergey
Nizovtsev.
-rw-r--r-- | input.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1929,8 +1929,13 @@ input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i) free(copy); return; } - } else + } else { n++; + if (n == nitems(p)) { + free(copy); + return; + } + } log_debug("%s: %u = %d", __func__, n - 1, p[n - 1]); } free(copy); |