From: Jim Meyering Date: Wed, 16 Nov 2011 19:10:39 +0000 (+0100) Subject: column: avoid memory overrun and/or use of uninitialized buffer X-Git-Tag: v2.21-rc1~173 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=26ae00a72b6cfb030a637d7a85ec06afac6f5d1a;p=thirdparty%2Futil-linux.git column: avoid memory overrun and/or use of uninitialized buffer * text-utils/column.c (maketbl): Use the right starting point and the right length when zeroing new memory after xrealloc. --- diff --git a/text-utils/column.c b/text-utils/column.c index f8fd350718..79d2842215 100644 --- a/text-utils/column.c +++ b/text-utils/column.c @@ -305,8 +305,8 @@ static void maketbl(wchar_t **list, int entries, wchar_t *separator) cols = xrealloc(cols, maxcols * sizeof(wchar_t *)); lens = xrealloc(lens, maxcols * sizeof(ssize_t)); /* zero fill only new memory */ - memset(lens + ((maxcols - DEFCOLS) * sizeof(ssize_t)), 0, - DEFCOLS * sizeof(int)); + memset(lens + (maxcols - DEFCOLS), 0, + DEFCOLS * sizeof(*lens)); } p = NULL; }