[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#22541: marked as done (libc6: snprintf incorrect return value)



Your message dated Wed, 19 Apr 2000 11:08:23 -0700
with message-id <p04310104b523a642c0c4@[206.163.71.146]>
and subject line Bug#22541: Better info on snprintf bug
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Darren Benham
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 17 May 1998 17:18:26 +0000
Received: (qmail 27984 invoked from network); 17 May 1998 17:18:25 -0000
Received: from hilfy.magd.cam.ac.uk (mail@131.111.221.99)
  by debian.novare.net with SMTP; 17 May 1998 17:18:25 -0000
Received: from gpp10 by hilfy.magd.cam.ac.uk with local (Exim 1.92 #1)
	id 0yb74p-0003Ms-00 (Debian); Sun, 17 May 1998 18:18:23 +0100
From: Giuliano P Procida <gpp10@cam.ac.uk>
Subject: libc6: snprintf incorrect return value
To: submit@bugs.debian.org
X-Mailer: bug 3.1.5
Message-Id: <E0yb74p-0003Ms-00@hilfy.magd.cam.ac.uk>
Date: Sun, 17 May 1998 18:18:23 +0100

Package: libc6
Version: 2.0.7pre3-1

The function call

  snprintf (<any pointer>, 0, "foo");

should return -1, but instead returns 0. A similar statement applies
to vnsprintf.

I hope this report is of some use.
Giuliano Procida.

-- System Information
Debian Release: 2.0 (frozen)
Kernel Version: Linux hilfy 2.0.34 #1 Wed Apr 22 22:51:55 BST 1998 i586 unknown

Versions of the packages libc6 depends on:
ii  ldso            1.9.8-1        The Linux dynamic linker, library and utilit
---------------------------------------
Received: (at 22541-done) by bugs.debian.org; 21 Apr 2000 19:55:53 +0000
Received: (qmail 28250 invoked from network); 21 Apr 2000 19:55:41 -0000
Received: from cerberus.espy.org (mail@206.163.71.145)
  by master.debian.org with SMTP; 21 Apr 2000 19:55:41 -0000
Received: from hercules.espy.org ([206.163.71.146]) [::ffff:206.163.71.146] 
	by cerberus.espy.org with esmtp (Exim 3.12 #1 (Debian GNU/Linux))
	id 12ijWU-000258-00; Fri, 21 Apr 2000 12:55:30 -0700
Mime-Version: 1.0
X-Sender: jk@mail.espy.org
Message-Id: <p04310104b523a642c0c4@[206.163.71.146]>
In-Reply-To: <87embjdmcf.fsf@zip.com.au>
References: <E0ycGFn-0005KF-00@hilfy.magd.cam.ac.uk>
 <87embjdmcf.fsf@zip.com.au>
Date: Wed, 19 Apr 2000 11:08:23 -0700
To: Kevin Ryde <user42@zip.com.au>, 22541-done@bugs.debian.org
From: Joel Klecker <jk@espy.org>
Subject: Re: Bug#22541: Better info on snprintf bug
Cc: Giuliano P Procida <gpp10@cam.ac.uk>
Content-Type: text/plain; charset="us-ascii"

At 08:03 +1000 2000-01-16, Kevin Ryde wrote:
>Giuliano P Procida <gpp10@cam.ac.uk> writes:
>>
>> Here is some more! Please ignore previous witterings which indicated
>> that I had forgotten that size_t is unsigned!
>>
>> #include <stdio.h>
>> #include <stdarg.h>
>> int main () {
>>   char b[9];
>>   int stat;
>>   int  i;
>>   for (i = 0; i < 5; ++i) {
>>     stat = snprintf (b, i, "foo");
>>     printf ("i %u, got %d, exp %d\n", i, stat, (size_t) i < 4 ? -1 : 3);
>>   }
>>   for (i = -1; i < 5; ++i) {
>>     stat = snprintf (b, i, "foo");
>>     printf ("i %u, got %d, exp %d\n", i, stat, (size_t) i < 4 ? -1 : 3);
>>   }
>>   return 0;
>> }
>>
>> i 0, got 0, exp -1    <- sick
>> i 1, got -1, exp -1   <- works OK
>> i 2, got -1, exp -1
>> i 3, got -1, exp -1
>> i 4, got 3, exp 3
>> i 4294967295, got 3, exp 3 <- throw in MAX_UINT
>> i 0, got 0, exp -1    <- sick
>> i 1, got 3, exp -1    <- BROKEN this time
>> i 2, got -1, exp -1
>> i 3, got -1, exp -1
>> i 4, got 3, exp 3
>
>
>I just gave snprintf() a try in libc6 2.1.2-11 and it now returns 3 in
>all the above cases, which is correct per the change to ISO C9x
>described in the info docs for snprintf(), so I think this bug could
>be closed.

Thanks for noticing this, I will do so.
-- 
Joel Klecker (aka Espy)       <URL:mailto:espy@debian.org>
Debian Package Maintainer for the GNU C Library.


Reply to: