Add missing parentheses to fix a segmentation fault that is easily
reproducable with `jot -s " " 400 1 | column -t'. The bug was present in the the original CSRG 'column -t' added in 1989.
This commit is contained in:
parent
d7b167b57b
commit
6508a1ecdc
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=162453
@ -247,10 +247,10 @@ maketbl(void)
|
|||||||
(cols[coloff] = wcstok(p, separator, &last));
|
(cols[coloff] = wcstok(p, separator, &last));
|
||||||
p = NULL)
|
p = NULL)
|
||||||
if (++coloff == maxcols) {
|
if (++coloff == maxcols) {
|
||||||
if (!(cols = realloc(cols, (u_int)maxcols +
|
if (!(cols = realloc(cols, ((u_int)maxcols +
|
||||||
DEFCOLS * sizeof(char *))) ||
|
DEFCOLS) * sizeof(char *))) ||
|
||||||
!(lens = realloc(lens,
|
!(lens = realloc(lens,
|
||||||
(u_int)maxcols + DEFCOLS * sizeof(int))))
|
((u_int)maxcols + DEFCOLS) * sizeof(int))))
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
memset((char *)lens + maxcols * sizeof(int),
|
memset((char *)lens + maxcols * sizeof(int),
|
||||||
0, DEFCOLS * sizeof(int));
|
0, DEFCOLS * sizeof(int));
|
||||||
|
Loading…
Reference in New Issue
Block a user