From: Pavel Roskin <proski@gnu.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] off-by-one bugs found by valgrind
Date: Wed, 21 Dec 2005 16:47:21 -0500 [thread overview]
Message-ID: <1135201641.15567.7.camel@dv> (raw)
In-Reply-To: <43A9C654.2010009@zytor.com>
On Wed, 2005-12-21 at 13:17 -0800, H. Peter Anvin wrote:
> >>quote_c_style_counted() in quote.c uses a dangerous construct, when a
> >>variable is incremented once and used twice in the same expression.
> >
> > Sorry, I do not follow you. Isn't && a sequence point?
The patch is right, but my comment was wrong, sorry.
The actual problem detected by valgrind is that sp is dereferenced
before it's checked for the upper boundary. So, if e.g. namelen is 6,
the code reads name[6] into ch and then leaves the loop.
> && is a sequence point. The code is techically fine, but it's harder
> than necessary to read.
That alone should be a good reason to apply this patch.
--
Regards,
Pavel Roskin
next prev parent reply other threads:[~2005-12-21 21:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-21 20:35 [PATCH] off-by-one bugs found by valgrind Pavel Roskin
2005-12-21 20:59 ` Junio C Hamano
2005-12-21 21:17 ` H. Peter Anvin
2005-12-21 21:47 ` Pavel Roskin [this message]
2005-12-22 0:27 ` Horst von Brand
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=1135201641.15567.7.camel@dv \
--to=proski@gnu.org \
--cc=git@vger.kernel.org \
--cc=hpa@zytor.com \
--cc=junkio@cox.net \
/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).