Current icon indicating copy to clipboard operation
Current copied to clipboard

Warning: tmpnam is not safe

Open sompylasar opened this issue 9 years ago • 3 comments

g++ -std=c++11 -Wall -W -g -x objective-c++ -fobjc-arc -o .noshit/test test.cc -pthread -framework Foundation
In file included from test.cc:29:
./file.h:105:24: warning: 'tmpnam' is deprecated: This function is provided for
      compatibility reasons only. Due to security concerns inherent in the
      design of tmpnam(3), it is highly recommended that you use mkstemp(3)
      instead. [-Wdeprecated-declarations]
    assert(buffer == ::tmpnam(buffer));
                       ^
/usr/include/assert.h:93:25: note: expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE...
                        ^
/usr/include/stdio.h:274:7: note: 'tmpnam' has been explicitly marked deprecated
      here
char    *tmpnam(char *);
         ^
In file included from test.cc:32:
In file included from ./../3party/gtest/gtest-main-with-dflags.h:13:
In file included from ./../3party/gtest/gtest.h:6:
In file included from ./../3party/gtest/src/gtest-all.cc:39:

sompylasar avatar Feb 23 '15 11:02 sompylasar

Refs #76

sompylasar avatar Feb 23 '15 11:02 sompylasar

This one is a bit trickier (not only mkstemp has a very different calling convention, it also opens the file, which is clever, but would require a bit of a redesign on out side).

Could you try changing it into some

TODO(dkorolev): Fix temporary file names generation.
return strings::Printf("/tmp/.noshit-%08x", rand());

for Apple and see whether it gets you past this problem? You'd need to #include "../strings/printf.h" and #include <cstdlib> for rand().

dkorolev avatar Feb 23 '15 18:02 dkorolev

Just 1.5 years, huh? Hang on :)

dkorolev avatar Aug 28 '16 04:08 dkorolev

Hey, this is fixed, for a long time as of now! Closing.

dimacurrentai avatar Mar 12 '24 17:03 dimacurrentai