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


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

Re: sysdeps/posix/tempname.c is broken.


> 
> >>>>> H J Lu writes:
> 
> HJ Lu> Hi,
> HJ Lu> sysdeps/posix/tempname.c is broken. "make check" failed in assert and
> HJ Lu> stdio-common.
> 
> The following patch is needed on top of what's currently under cvs.
> My patch to fix Uli's patch was broken:-(.
> 
> I'm still building the whole glibc so that I can't verify if it passes
> `make check' now but this *should* be the final fix for it.
> 

There is another bug. "%*s" != "%.*s". "%*s" may lead memory leak.

Thanks.


H.J.
---
Tue Dec 15 08:00:17 1998  H.J. Lu  <hjl@gnu.org>

	* sysdeps/posix/tempname.c (__path_search): Fix the maximum
	string length.

Index: sysdeps/posix/tempname.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/sysdeps/posix/tempname.c,v
retrieving revision 1.1.1.9
diff -u -p -r1.1.1.9 tempname.c
--- tempname.c	1998/12/15 18:50:11	1.1.1.9
+++ tempname.c	1998/12/15 18:56:57
@@ -95,7 +95,7 @@ __path_search (char *tmpl, size_t tmpl_l
       return -1;
     }
 
-  sprintf (tmpl, "%*s/%*sXXXXXX", dlen, dir, plen, pfx);
+  sprintf (tmpl, "%.*s/%.*sXXXXXX", dlen, dir, plen, pfx);
   return 0;
 }
 


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