Re: [PATCH] column: avoid memory overrun and/or use of uninitialized buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 16, 2011 at 08:10:39PM +0100, Jim Meyering wrote:
>  text-utils/column.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/text-utils/column.c b/text-utils/column.c
> index f8fd350..79d2842 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));

 Ah, this is my bug... (in the original code was cast to char *).

 Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux