changeset 5513:d1524728d491

[gaim-migrate @ 5912] Dario Sarango (darius_wolfson) patched bug 743000 writting: "Summary: scans the manual browser command for multiple %s. If multiple %s are found, error message is given and the web_command is not executed. " committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sun, 25 May 2003 16:52:35 +0000
parents e41b04bb4afe
children 5664dbaf670c
files src/browser.c
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser.c	Sun May 25 13:53:11 2003 +0000
+++ b/src/browser.c	Sun May 25 16:52:35 2003 +0000
@@ -585,6 +585,7 @@
 
 		case BROWSER_MANUAL: {
 			char *space_free_url = NULL;
+			char *web_tmp = NULL;
 
 			if (!web_command[0]) {
 				gaim_notify_error(NULL, NULL,
@@ -597,11 +598,26 @@
 
 			space_free_url = g_strdup(url);
 			g_strdelimit(space_free_url, " ", '+');
-			if(strstr(web_command, "%s"))
+			/*
+			if (strstr(web_command, "%s"))
 				command = g_strdup_printf(web_command, space_free_url);
+
+			Replaced the above with the following to avoid users
+			from entering more than one %s as part of the browser
+			command.
+			*/
+			web_tmp = strstr(web_command, "%s");
+			if(web_tmp)
+			{
+				if (strstr((web_tmp + 1), "%s"))
+					command = g_strdup_printf(web_command, space_free_url);
+				else
+					gaim_notify_error(NULL, NULL, _("Unable to launch your browser because the 'Manual' browser command has too many '%s'."), NULL);
+			}
 			else
 				command = g_strdup_printf("%s %s", web_command, space_free_url);
 			g_free(space_free_url);
+			g_free(web_tmp);
 		} break;
 	}