From 3740fd1c389f9d6fa7008e4fe0090dce80c86c00 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Fri, 13 May 2011 21:49:05 -0400 Subject: [PATCH] Don't use a static buffer for ~/.mozilla/plugins Better avoid the potential buffer overflow. --- src/npw-config.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/npw-config.c b/src/npw-config.c index 32fc0b2..237cad7 100644 --- a/src/npw-config.c +++ b/src/npw-config.c @@ -248,13 +248,15 @@ static const char *get_system_mozilla_plugin_dir(void) static const char *get_user_mozilla_plugin_dir(void) { const char *home; - static char plugin_path[PATH_MAX]; + static char *plugin_path = NULL; + + if (plugin_path != NULL) + return plugin_path; if ((home = g_get_home_dir()) == NULL) return NULL; - sprintf(plugin_path, "%s/.mozilla/plugins", home); - return plugin_path; + return (plugin_path = g_build_filename(home, ".mozilla", "plugins", NULL)); } static const char **get_mozilla_plugin_dirs(void)