Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Nov 2010 09:36:36 GMT
From:      Yui NARUSE <naruse@airemix.jp>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/152042: wrong bufsize of __hdtoa
Message-ID:  <201011080936.oA89aaAO034522@www.freebsd.org>
Resent-Message-ID: <201011080940.oA89e7r2093298@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         152042
>Category:       misc
>Synopsis:       wrong bufsize of __hdtoa
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 08 09:40:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Yui NARUSE
>Release:        8.1-RELEASE
>Organization:
>Environment:
FreeBSD windy.airemix.net 8.1-RELEASE FreeBSD 8.1-RELEASE #1: Sat Jul 24 11:27:04 JST 2010     naruse@windy.airemix.net:/usr/obj/usr/src/sys/GENERIC  amd64
>Description:
When ndigits is given for __hdtoa, the bufsize for rv_alloc is too small.
It must add 1 for NUL termination.
>How-To-Repeat:

>Fix:
/usr/src/lib/libc/gdtoa % diff -u _hdtoa.c _hdtoa.c.orig
--- _hdtoa.c    2010-11-08 18:31:46.000000000 +0900
+++ _hdtoa.c.orig       2010-11-08 18:31:44.000000000 +0900
@@ -109,7 +109,7 @@
         * enough space for all the digits.
         */
        bufsize = (ndigits > 0) ? ndigits : SIGFIGS;
-       s0 = rv_alloc(bufsize);
+       s0 = rv_alloc(bufsize+1);
 
        /* Round to the desired number of digits. */
        if (SIGFIGS > ndigits && ndigits > 0) {

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011080936.oA89aaAO034522>