From 352561d06b62e196987d020fe9f53093469a411b Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Sun, 9 Feb 2003 07:35:23 +0000 Subject: fix length calculation. (create_folder_directory): remove alloca usage, 2003-02-09 Larry Ewing * e-local-storage.c (remove_folder_directory): fix length calculation. (create_folder_directory): remove alloca usage, clears up crash. svn path=/trunk/; revision=19856 --- shell/ChangeLog | 5 +++++ shell/e-local-storage.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 94260f2f35..60f1b7abc1 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,8 @@ +2003-02-09 Larry Ewing + + * e-local-storage.c (remove_folder_directory): fix length calculation. + (create_folder_directory): remove alloca usage, clears up crash. + 2003-02-07 Larry Ewing * e-shell-folder-creation-dialog.c diff --git a/shell/e-local-storage.c b/shell/e-local-storage.c index 3b5d3fa86a..380f88fba4 100644 --- a/shell/e-local-storage.c +++ b/shell/e-local-storage.c @@ -358,17 +358,18 @@ create_folder_directory (ELocalStorage *local_storage, char *parent; /* Create the `subfolders' subdirectory under the parent. */ - parent = alloca(strlen(parent_path)+2); - sprintf(parent, "%s/", parent_path); + parent = g_strdup_printf ("%s/", parent_path); subfolders_directory_physical_path = e_path_to_physical (priv->base_path, parent); if (! g_file_test (subfolders_directory_physical_path, G_FILE_TEST_EXISTS)) { if (mkdir (subfolders_directory_physical_path, 0700) == -1) { g_free (subfolders_directory_physical_path); + g_free (parent); return errno_to_storage_result (); } } g_free (subfolders_directory_physical_path); + g_free (parent); } g_free (parent_path); @@ -501,7 +502,7 @@ remove_folder_directory (ELocalStorage *local_storage, char *subfolders_directory_physical_path; char *parent_path; - parent_path = g_strndup (path, folder_name - path); + parent_path = g_strndup (path, strlen (path) - strlen (folder_name)); subfolders_directory_physical_path = e_path_to_physical (priv->base_path, parent_path); g_free (parent_path); -- cgit