summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-09-12 11:52:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2013-09-12 13:09:04 +0100
commit5db93465bb5fc7f90b897783302118c198ae55f3 (patch)
tree1324fff0275661d3abdd43d3df023bbf45d89d46 /svx
parent5f5a981dd6df406b7bbddd88fa0b701b5a8d2246 (diff)
CID#705986 avoid tmpnam
Change-Id: I47fa843284a074ef77da8631f4e4de914f4d0cf7
Diffstat (limited to 'svx')
-rw-r--r--svx/source/dialog/sendreportunx.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/svx/source/dialog/sendreportunx.cxx b/svx/source/dialog/sendreportunx.cxx
index 9a058ad54fc6..7d1afc6ccce0 100644
--- a/svx/source/dialog/sendreportunx.cxx
+++ b/svx/source/dialog/sendreportunx.cxx
@@ -30,6 +30,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#define RCFILE ".crash_reportrc"
@@ -206,8 +208,12 @@ namespace svx{
OUString strSubject(GetDocType());
osl_setEnvironment(sSubEnvVar.pData, strSubject.pData);
- char szBodyFile[L_tmpnam] = "";
- FILE *fp = fopen( tmpnam( szBodyFile ), "w" );
+ char szBodyFile[]="/tmp/locrsXXXXXXX";
+ mode_t nOrigMode = umask(S_IRWXG | S_IRWXO);
+ int nDescriptor = mkstemp(szBodyFile);
+ umask(nOrigMode);
+
+ FILE *fp = nDescriptor != -1 ? fdopen(nDescriptor, "w") : NULL;
if ( fp )
{