This is the mail archive of the
libc-hacker@sourceware.cygnus.com
mailing list for the glibc project.
Re: sysdeps/posix/tempname.c is broken.
- To: aj@arthur.rhein-neckar.de (Andreas Jaeger)
- Subject: Re: sysdeps/posix/tempname.c is broken.
- From: hjl@lucon.org (H.J. Lu)
- Date: Tue, 15 Dec 1998 11:19:43 -0800 (PST)
- Cc: drepper@cygnus.com, libc-hacker@cygnus.com
>
> >>>>> 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;
}