php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20768 MySql temp file error
Submitted: 2002-12-02 13:19 UTC Modified: 2002-12-13 11:59 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: jphp at netjunky dot com Assigned:
Status: Wont fix Package: Compile Failure
PHP Version: 4.3.0RC2 OS: Debian 3.0 Stable / Sparc
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-12-02 13:19 UTC] jphp at netjunky dot com
When building 4.3.0RC2 against apache 1.3.26 DSO  I get an error stating that usage of tempnam() is insecure - line 103 of ext/mysql/libmysql/my_tempnam.c

I replaced line 103 with the following code, which builds and should function identically.

/* filespec will be dir + '/' + pfx + 'XXXXXX' + null */
res = malloc(strlen(dir) + strlen(pfx) + 8);
res[0] = '\0';
strcat(res, dir);
strcat(res, "/");
strcat(res, pfx);
strcat(res, "XXXXXX");
mkstemp(res);
/* res=tempnam((char *)dir, (my_string) pfx); */

Someone who knows the mysql code should check this if it's not a local build problem on my end.

Other details:

Linux Kernel 2.4.18 / sparc64
libc6 2.2.5-11.2
gcc 2.95.4 20011002 (Debian prerelease)

./configure  --with-mysql --with-apxs --prefix=/usr --sysconfdir=/etc --localstatedir=/var/php --with-zlib --with-dom  --with-gd --with-mysql --enable-sockets --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-xpm-dir=/usr/X11R6/lib --with-freetype-dir=/usr/lib

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-02 13:23 UTC] derick@php.net
It's harmless; just ignore it. The MySQL library uses it in a safe way anyway.

Derick
 [2002-12-02 13:25 UTC] jphp at netjunky dot com
It may be safe, but it stops the compile.  I can't build with the code as is.
 [2002-12-02 13:26 UTC] derick@php.net
It's a warning, not an error. 
 [2002-12-13 10:39 UTC] ben at thelocust dot org
it may be a warning, and not an error, but it sure brings my build to a halt every time -- i'm not gcc genius, but how should we get around this?  I'm using gcc 3.2.1, libtool 1.4.3, btw.
 [2002-12-13 11:59 UTC] msopacua@php.net
does it stop the build or is it the last warning IN the build?

If it says "warning", there is no problem. Gcc 3.0x used to signal it as an error and was quickly corrected. I hope you're not saying it's status is back to "error" again, cause that would "not be very nice". It's not a PHP problem either, when the gcc people decide to classify a "MAY be used unsafe" statement, as an error.
 [2003-02-13 15:29 UTC] madmikey at unrealplayground dot com
I had this same problem on RH 7.2.  I know it's supposed to be a warning, but the build stops right there everytime I used the --with-mysql configure option.

After looking hard for a fix, I finally changed line 103 of my_tempnam.c to read:

res=mkstemp((char*) dir); /* Use stand. dir with prefix */

Now I'm not a C programmer by any stretch, but I was able to compile successfully and install.  Everything appears to be working correctly.
 [2003-04-02 19:26 UTC] kangus at acats dot com
the tempnam issue stopped me dead on Yoper with php-4.3.2RC1/php-4.3.1
No amount of screwing around will get me past make.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC