Summary: | binutils-2.15.92.0.2-r7 dangerous use of mktemp(), please use mkstemp() | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | ArYiX <aryixb> |
Component: | [OLD] Core system | Assignee: | Gentoo Toolchain Maintainers <toolchain> |
Status: | RESOLVED WONTFIX | ||
Severity: | critical | CC: | chriswhite |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | x86 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
ArYiX
2005-04-08 08:05:30 UTC
=================================================================== RCS file: /cvs/src/src/binutils/bucomm.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- src/binutils/bucomm.c 2001/09/26 01:55:19 1.10 +++ src/binutils/bucomm.c 2001/11/12 16:17:39 1.11 @@ -233,14 +233,14 @@ #endif strcat (tmpname, "/"); strcat (tmpname, template); - mktemp (tmpname); + close (mkstemp (tmpname)); *slash = c; } else { tmpname = xmalloc (sizeof (template)); strcpy (tmpname, template); - mktemp (tmpname); + close (mkstemp (tmpname)); } return tmpname; } half the uses are by legacy code which isnt built on linux systems the other half looks like a pain to extract ... and probably isnt worth it ... binutils/bucomm.c defines make_tempname() which uses mktemp() ... make_tempname() is used twice, once by ar and once by objcopy and in both cases, it rarely can be used to take advantage of make_tempname() builds a temp file based upon a filename ... in the case of objcopy and ar, it'll create a temp file in the same dir as the file you're working on. so if you run `ar r archive.a objectfile.o`, it'll create the tempfile in $PWD so this isnt really an issue unless you work on object files / archives in a world writable directory (like /tmp) which, imho, isnt a very common thing if someone feels like writing a patch to resolve this, i'll look it over, but 'fixing' the current behavior doesnt gain anything *** Bug 105819 has been marked as a duplicate of this bug. *** |