This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

asprintf/psignal.c change really correct?


Hi,

We have the following change in current glibc CVS.
I don't think that it is correct: if asprintf fails, we
use fprintf or fwprintf. But than we access buf and try to
print the content. But buf is undefined here.

  Thorsten

--- old/glibc-2.3/stdio-common/psignal.c        2004-03-19 08:30:54.000000000 +0100
+++ new/glibc-2.3/stdio-common/psignal.c        2004-06-14 17:03:29.000000000 +0200
@@ -57,7 +57,13 @@
     {
       char *buf;
 
-      (void) __asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig);
+      if (__asprintf (&buf, _("%s%sUnknown signal %d\n"), s, colon, sig) < 0)
+       {
+         if (_IO_fwide (stderr, 0) > 0)
+           (void) __fwprintf (stderr, L"%s%s%s\n", s, colon, _("Unknown signal"));
+         else
+           (void) fprintf (stderr, "%s%s%s\n", s, colon, _("Unknown signal"));
+       }
 
       if (_IO_fwide (stderr, 0) > 0)
        (void) __fwprintf (stderr, L"%s",  buf);

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]