diff options
author | iedowse <iedowse@FreeBSD.org> | 2006-09-19 22:11:43 +0000 |
---|---|---|
committer | iedowse <iedowse@FreeBSD.org> | 2006-09-19 22:11:43 +0000 |
commit | 750ab68ba1f38627cc3a1bdcd64c96b9a5aee0f9 (patch) | |
tree | 523b924112046399659e04d2f8b14e8ea372c2e7 /usr.bin/column | |
parent | fc7fc7fa1c7291ea74d27d6f4d5984554e5ec118 (diff) | |
download | FreeBSD-src-750ab68ba1f38627cc3a1bdcd64c96b9a5aee0f9.zip FreeBSD-src-750ab68ba1f38627cc3a1bdcd64c96b9a5aee0f9.tar.gz |
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.
Diffstat (limited to 'usr.bin/column')
-rw-r--r-- | usr.bin/column/column.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c index ccaa824..ca2837d 100644 --- a/usr.bin/column/column.c +++ b/usr.bin/column/column.c @@ -247,10 +247,10 @@ maketbl(void) (cols[coloff] = wcstok(p, separator, &last)); p = NULL) if (++coloff == maxcols) { - if (!(cols = realloc(cols, (u_int)maxcols + - DEFCOLS * sizeof(char *))) || + if (!(cols = realloc(cols, ((u_int)maxcols + + DEFCOLS) * sizeof(char *))) || !(lens = realloc(lens, - (u_int)maxcols + DEFCOLS * sizeof(int)))) + ((u_int)maxcols + DEFCOLS) * sizeof(int)))) err(1, NULL); memset((char *)lens + maxcols * sizeof(int), 0, DEFCOLS * sizeof(int)); |