Mercurial > pidgin
comparison src/protocols/msn/cmdproc.c @ 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 | a7affa2e2986 |
children | c30d81b4dd22 |
comparison
equal
deleted
inserted
replaced
8829:d5ca3e9a77e2 | 8830:f8038b1f7449 |
---|---|
156 msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, | 156 msn_cmdproc_send_quick(MsnCmdProc *cmdproc, const char *command, |
157 const char *format, ...) | 157 const char *format, ...) |
158 { | 158 { |
159 MsnServConn *servconn; | 159 MsnServConn *servconn; |
160 char *data; | 160 char *data; |
161 char *params; | 161 char *params = NULL; |
162 va_list arg; | 162 va_list arg; |
163 size_t len; | 163 size_t len; |
164 | 164 |
165 g_return_if_fail(cmdproc != NULL); | 165 g_return_if_fail(cmdproc != NULL); |
166 g_return_if_fail(command != NULL); | 166 g_return_if_fail(command != NULL); |
167 | 167 |
168 servconn = cmdproc->servconn; | 168 servconn = cmdproc->servconn; |
169 | 169 |
170 va_start(arg, format); | 170 if (format != NULL) { |
171 params = g_strdup_vprintf(format, arg); | 171 va_start(arg, format); |
172 va_end(arg); | 172 params = g_strdup_vprintf(format, arg); |
173 va_end(arg); | |
174 } | |
173 | 175 |
174 if (params != NULL) | 176 if (params != NULL) |
175 data = g_strdup_printf("%s %s\r\n", command, params); | 177 data = g_strdup_printf("%s %s\r\n", command, params); |
176 else | 178 else |
177 data = g_strdup_printf("%s\r\n", command); | 179 data = g_strdup_printf("%s\r\n", command); |
199 | 201 |
200 trans = g_new0(MsnTransaction, 1); | 202 trans = g_new0(MsnTransaction, 1); |
201 | 203 |
202 trans->command = g_strdup(command); | 204 trans->command = g_strdup(command); |
203 | 205 |
204 va_start(arg, format); | 206 if (format != NULL) { |
205 trans->params = g_strdup_vprintf(format, arg); | 207 va_start(arg, format); |
206 va_end(arg); | 208 trans->params = g_strdup_vprintf(format, arg); |
209 va_end(arg); | |
210 } | |
207 | 211 |
208 msn_cmdproc_send_trans(cmdproc, trans); | 212 msn_cmdproc_send_trans(cmdproc, trans); |
209 } | 213 } |
210 | 214 |
211 void | 215 void |