From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5318 invoked by alias); 23 Mar 2007 03:45:53 -0000 Received: (qmail 5310 invoked by uid 22791); 23 Mar 2007 03:45:52 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 Mar 2007 03:45:49 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l2N3jllj029842; Thu, 22 Mar 2007 23:45:47 -0400 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l2N3jkfB021676; Thu, 22 Mar 2007 23:45:46 -0400 Received: from greed.delorie.com (vpn-14-18.rdu.redhat.com [10.11.14.18]) by post-office.corp.redhat.com (8.12.11.20060308/8.11.6) with ESMTP id l2N3jkYr011141; Thu, 22 Mar 2007 23:45:46 -0400 Received: from greed.delorie.com (greed.delorie.com [127.0.0.1]) by greed.delorie.com (8.13.8/8.13.8) with ESMTP id l2N3jfh4002573; Thu, 22 Mar 2007 23:45:41 -0400 Received: (from dj@localhost) by greed.delorie.com (8.13.8/8.13.8/Submit) id l2N3jdLu002570; Thu, 22 Mar 2007 23:45:39 -0400 Date: Fri, 23 Mar 2007 03:45:00 -0000 Message-Id: <200703230345.l2N3jdLu002570@greed.delorie.com> From: DJ Delorie To: qinwei@sunnorth.com.cn CC: gdb-patches@sourceware.org In-reply-to: (message from qinwei on Fri, 23 Mar 2007 10:44:20 +0800) Subject: Re: [patch] libiberty/vasprintf.c bug References: X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00202.txt.bz2 > > If ptr is NULL, shouldn't we add strlen("(null)") ? > > Yes. This will cause error. > const char *p = NULL; > int i = strlen (p); I understand that. My question was, if you printf("%s", NULL), what happens? If it prints "(null)", does that mean you need to account for the length of that string in your calculations? (also, note that libiberty patches go to gcc-patches@gcc.gnu.org, in addition to any other lists who might be interested)