[Bug manual/2920] New: Error in snprintf example

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug manual/2920] New: Error in snprintf example

glaubitz at physik dot fu-berlin.de
The example for snprintf shows how to realloc memory, if the buffer for snprintf
is too small. The first call of snprintf uses the variable "size" as size
argument for snprintf.  After that the buffer is reallocated to the size "nchars
+1".  But the value of size isn't changed and size is also used in the second
call of snprintf.  I think this is wrong, because the second call of snprintf
must use "nchars +1" instead of the variable "size", which contains still the
size of the too small buffer.

--
           Summary: Error in snprintf example
           Product: glibc
           Version: 2.3.6
            Status: NEW
          Severity: minor
          Priority: P2
         Component: manual
        AssignedTo: roland at gnu dot org
        ReportedBy: ceving at web dot de
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=2920

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
Reply | Threaded
Open this post in threaded view
|

[Bug manual/2920] Error in snprintf example

glaubitz at physik dot fu-berlin.de

------- Additional Comments From jakub at redhat dot com  2006-09-07 20:49 -------
This has been fixed a long time ago:
2006-02-03  Ulrich Drepper  <[hidden email]>

        * manual/stdio.texi (Formatted Output Functions): Fix make_message
        example.  Patch by NIIBE Yutaka <[hidden email]>.


--
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://sourceware.org/bugzilla/show_bug.cgi?id=2920

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.