From: "H. J. Lu" <hjl@lucon.org>
To: Jan Beulich <jbeulich@novell.com>
Cc: Nick Clifton <nickc@redhat.com>, binutils@sources.redhat.com
Subject: Re: PATCH: Fix buffer overflow in gas
Date: Tue, 02 May 2006 14:58:00 -0000 [thread overview]
Message-ID: <20060502145800.GA10963@lucon.org> (raw)
In-Reply-To: <44578A83.76E4.0078.0@novell.com>
On Tue, May 02, 2006 at 04:36:19PM +0200, Jan Beulich wrote:
> >+static char output_invalid_buf[sizeof (unsigned char) * 2 + 6];
>
> I'm sorry to say that this, but regardless of actual width of 'char' or 'unsigned char' the above declaration still
> always produces an 8-unit array. What you mean is making room for as many hex digits as an 'unsigned char' can be
> converted to. Without knowing CHAR_BIT (or equivalent) I cannot see how you would be able to derive that. Unfortunately,
> previous work on binutils has shown that one apparently shouldn't make assumptions about the availability of limits.h
> (despite this having been a standard header for at least 15 years), and hence CHAR_BIT is not generally usable here.
> Where needed, I (and apparently others) generally made the assumption that if limits.h isn't available, then the machine
> is supposed to be a 8-bit-bytes one (and bad luck to those perhaps hypothetical machines that aren't and that don't
> provide the header).
I don't want to get too complicated here. We won't have buffer overflow
anymore no matter what CHAR_BIT is. Feel free to improve it.
H.J.
next prev parent reply other threads:[~2006-05-02 14:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-01 18:40 H. J. Lu
2006-05-02 9:48 ` Nick Clifton
2006-05-02 13:31 ` H. J. Lu
2006-05-02 14:20 ` H. J. Lu
2006-05-02 14:35 ` Jan Beulich
2006-05-02 14:58 ` H. J. Lu [this message]
2006-05-02 16:53 ` Andreas Schwab
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=20060502145800.GA10963@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
--cc=jbeulich@novell.com \
--cc=nickc@redhat.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).