aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog15
-rw-r--r--embed/mozilla/Makefile.am4
-rw-r--r--embed/mozilla/mozilla-embed-persist.cpp25
-rw-r--r--src/window-commands.c1
4 files changed, 26 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 84de34dfb..835df2b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2004-02-21 Marco Pesenti Gritti <marco@gnome.org>
+
+ * embed/mozilla/Makefile.am:
+
+ Actually remove nsUnicharUtils.*
+
+ * embed/mozilla/mozilla-embed-persist.cpp:
+
+ Use our helper to construct tmp file name: fix
+ security issue.
+
+ * src/window-commands.c: (save_temp_source):
+
+ Cosmetic change
+
2004-02-20 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EventContext.cpp:
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 1340ef216..8e33860c4 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -94,6 +94,4 @@ libephymozillaembed_la_SOURCES = \
mozilla-embed-single.cpp \
mozilla-embed-single.h \
mozilla-notifiers.cpp \
- mozilla-notifiers.h \
- nsUnicharUtils.cpp \
- nsUnicharUtils.h
+ mozilla-notifiers.h
diff --git a/embed/mozilla/mozilla-embed-persist.cpp b/embed/mozilla/mozilla-embed-persist.cpp
index 7a20863ef..7de40e6d3 100644
--- a/embed/mozilla/mozilla-embed-persist.cpp
+++ b/embed/mozilla/mozilla-embed-persist.cpp
@@ -25,6 +25,7 @@
#include "mozilla-embed-persist.h"
#include "mozilla-embed.h"
#include "ephy-embed-shell.h"
+#include "ephy-file-helpers.h"
#include "EphyBrowser.h"
#include "EphyHeaderSniffer.h"
#include "MozDownload.h"
@@ -162,21 +163,15 @@ impl_save (EphyEmbedPersist *persist)
g_assert (browser != NULL || uri != NULL);
/* Get a temp filename to save to */
- nsCOMPtr<nsIProperties> dirService(do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID));
- NS_ENSURE_TRUE (dirService, FALSE);
-
- nsCOMPtr<nsIFile> tmpFile;
- dirService->Get("TmpD", NS_GET_IID(nsIFile), getter_AddRefs(tmpFile));
- if (!tmpFile) return FALSE;
-
- /* FIXME: make this filename non-guessable */
- static short unsigned int tmpRandom = 0;
- nsAutoString tmpNo;
- tmpNo.AppendInt(tmpRandom++);
- nsAutoString saveFile(NS_LITERAL_STRING("-sav"));
- saveFile += tmpNo;
- saveFile += NS_LITERAL_STRING("tmp");
- tmpFile->Append(saveFile);
+ char *tmp_filename, *base;
+ base = g_build_filename (g_get_tmp_dir (), "sav-XXXXXX", NULL);
+ tmp_filename = ephy_file_tmp_filename (base, "html");
+ if (tmp_filename == NULL) return FALSE;
+ g_free (base);
+
+ nsCOMPtr<nsILocalFile> tmpFile = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID);
+ tmpFile->InitWithNativePath (nsDependentCString (tmp_filename));
+ g_free (tmp_filename);
/* Get the uri to save to */
nsCOMPtr<nsIURI> inURI;
diff --git a/src/window-commands.c b/src/window-commands.c
index 825b0d894..dd952d474 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -738,7 +738,6 @@ save_temp_source (EphyEmbed *embed)
{
char *tmp, *base;
EphyEmbedPersist *persist;
-
const char *static_temp_dir;
static_temp_dir = ephy_file_tmp_dir ();