From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 801 invoked by alias); 2 May 2006 14:35:37 -0000 Received: (qmail 774 invoked by uid 22791); 2 May 2006 14:35:37 -0000 X-Spam-Check-By: sourceware.org Received: from public.id2-vpn.continvity.gns.novell.com (HELO emea1-mh.id2.novell.com) (195.33.99.129) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 02 May 2006 14:35:31 +0000 Received: from EMEA1-MTA by emea1-mh.id2.novell.com with Novell_GroupWise; Tue, 02 May 2006 15:35:26 +0200 Message-Id: <44578A83.76E4.0078.0@novell.com> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Beta Date: Tue, 02 May 2006 14:35:00 -0000 From: "Jan Beulich" To: "H. Lu" Cc: "Nick Clifton" , Subject: Re: PATCH: Fix buffer overflow in gas References: <20060501184006.GA2583@lucon.org> <44572AAF.4080203@redhat.com> <20060502133130.GB10201@lucon.org> <20060502142031.GA10660@lucon.org> In-Reply-To: <20060502142031.GA10660@lucon.org> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00049.txt.bz2 >+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). Jan