This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 2876
  [Build] "Dangerous" mktemp warning Last modified: 2006-10-13 10:14:10
     Query page      Enter new bug
Bug#: 2876   Hardware:   Reporter: Mohammed Adnène Trojette <adn@diwi.org>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: unassigned@sources.redhat.com   Target Milestone:  
Summary:
Keywords:

Attachment Description Type Created Actions
03_dangerous_mktemp_in_bucomm_288001.patch Patch to replace mktemp with mkstemp patch 2006-07-04 18:26 Edit | Diff
binutils-2.17-hardened_tmp-1.patch new mkstemp/mkdtemp patch patch 2006-10-09 12:22 Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 2876 depends on: Show dependency tree
Show dependency graph
Bug 2876 blocks:

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2006-07-04 18:25
Here is Debian bug report against binutils:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=288001

From: Jari <jari.aalto@cante.net>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: binutils: [source build]  warning: the use of `mktemp' is dangerous, 
better use `mkstemp'
Date: Fri, 31 Dec 2004 17:46:40 +0200

Package: binutils
Version: 2.15-5
Severity: minor


Compiling from source gives following warnings that could be corrected.

bucomm.o(.text+0xa99): In function `make_tempname':
/tmp/bucomm.c:425: warning: the use of `mktemp' is dangerous, better use `mkstemp'

------- Additional Comment #1 From Mohammed Adnène Trojette 2006-07-04 18:26 -------
Created an attachment (id=1135)
Patch to replace mktemp with mkstemp

------- Additional Comment #2 From Nick Clifton 2006-07-06 11:06 -------
Hi Mohammed,

  This is a known problem, but your fix will not work.  For a discussion of why,
please see this thread:

  http://sourceware.org/ml/binutils/2003-07/msg00009.html

Cheers
  Nick

------- Additional Comment #3 From Robert Connolly 2006-10-09 12:22 -------
Created an attachment (id=1360)
new mkstemp/mkdtemp patch

I made this patch from OpenBSD-cvs Binutils source, and added some autoconf
stuff so mktemp(3) will be used if the system does not have mkstemp/mkdtemp(3).
This patch should allow systems with mkstemp/mkdtemp to use them while staying
portable to systems without mkstemp.

------- Additional Comment #4 From Robert Connolly 2006-10-11 06:27 -------
Reopen bug with proposed patch (request for comments).

------- Additional Comment #5 From Nick Clifton 2006-10-13 10:14 -------
Hi Robert,

  Thanks for the patch.  I have tidied it up slightly and applied it along with
this ChangeLog entry.

Cheers
  Nick

binutils/ChangeLog
2006-10-13  Robert Connolly  <robert@linuxfromscratch.org>

	PR binutils/2876
	* configure.in: Check for the mkstemp and mkdtemp functions.
	* configure: Regenerate.
	* config.in (HAVE_MKDTEMP): New potential define.
	(MAKE_MKSTEMP): Likewise.
	* bucomm.c (make_tempname): Use mkstemp if it is available.
	(make_tempdir): New function: Create a temporary directory using
	mkdtemp, if it is available.
	* bucomm.h (make_tempdir): New prototype.
	* objcopy.c (copy_archive): Use make_tempdir if it is available.
	(strip_main): Produce an warning message if a temporary file could
	not be created.
	(copy_main): Likewise.
	* ar.c (write_archive): Likewise.

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In