# HG changeset patch # User Mikael Berthe # Date 1232141211 -3600 # Node ID 248da27faff34934d043fbe21771992c8966cce1 # Parent 2e86c1cc4eb17c0071ce0b772cec652ebfe1d194 Fix segfault when using /say_to with a bad syntax (reported by ISBear) diff -r 2e86c1cc4eb1 -r 248da27faff3 mcabber/src/commands.c --- a/mcabber/src/commands.c Thu Oct 30 19:47:11 2008 +0100 +++ b/mcabber/src/commands.c Fri Jan 16 22:26:51 2009 +0100 @@ -1459,7 +1459,7 @@ } // Check for an option parameter - while (TRUE) { + while (*paramlst) { if (!strcmp(*paramlst, "-q")) { char **oldparamlst = paramlst; paramlst = split_arg(*(oldparamlst+1), 2, 1); // jid, message @@ -1469,6 +1469,10 @@ char **oldparamlst = paramlst; paramlst = split_arg(*(oldparamlst+1), 2, 1); // filename, jid free_arg_lst(oldparamlst); + if (!*paramlst) { + scr_LogPrint(LPRINT_NORMAL, "Wrong usage."); + return; + } file = g_strdup(*paramlst); // One more parameter shift... oldparamlst = paramlst; @@ -1478,6 +1482,11 @@ break; } + if (!*paramlst) { + scr_LogPrint(LPRINT_NORMAL, "Wrong usage."); + return; + } + fjid = *paramlst; msg = *(paramlst+1);