From: Karel Zak <kzak@redhat.com>
To: Jim Meyering <jim@meyering.net>
Cc: List util-linux-ng <util-linux-ng@vger.kernel.org>
Subject: Re: [PATCH] column: avoid memory overrun and/or use of uninitialized buffer
Date: Wed, 16 Nov 2011 23:54:00 +0100 [thread overview]
Message-ID: <20111116225400.GP7916@nb.net.home> (raw)
In-Reply-To: <87fwhn6fyo.fsf@rho.meyering.net>
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@redhat.com>
http://karelzak.blogspot.com
prev parent reply other threads:[~2011-11-16 22:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 19:10 [PATCH] column: avoid memory overrun and/or use of uninitialized buffer Jim Meyering
2011-11-16 22:54 ` Karel Zak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111116225400.GP7916@nb.net.home \
--to=kzak@redhat.com \
--cc=jim@meyering.net \
--cc=util-linux-ng@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).