changeset 8830:f8038b1f7449

[gaim-migrate @ 9594] Patch by Daniel Atallah to prevent passing NULL to a vsprintf, which was causing gaim to exit (but not crash, for some reason). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Tue, 27 Apr 2004 02:33:29 +0000
parents d5ca3e9a77e2
children ffecda0c1f45
files src/protocols/msn/cmdproc.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/msn/cmdproc.c	Tue Apr 27 02:12:08 2004 +0000
+++ b/src/protocols/msn/cmdproc.c	Tue Apr 27 02:33:29 2004 +0000
@@ -158,7 +158,7 @@
 {
 	MsnServConn *servconn;
 	char *data;
-	char *params;
+	char *params = NULL;
 	va_list arg;
 	size_t len;
 
@@ -167,9 +167,11 @@
 
 	servconn = cmdproc->servconn;
 
-	va_start(arg, format);
-	params = g_strdup_vprintf(format, arg);
-	va_end(arg);
+	if (format != NULL) {
+		va_start(arg, format);
+		params = g_strdup_vprintf(format, arg);
+		va_end(arg);
+	}
 
 	if (params != NULL)
 		data = g_strdup_printf("%s %s\r\n", command, params);
@@ -201,9 +203,11 @@
 
 	trans->command = g_strdup(command);
 
-	va_start(arg, format);
-	trans->params = g_strdup_vprintf(format, arg);
-	va_end(arg);
+	if (format != NULL) {
+		va_start(arg, format);
+		trans->params = g_strdup_vprintf(format, arg);
+		va_end(arg);
+	}
 
 	msn_cmdproc_send_trans(cmdproc, trans);
 }