[dev] [sic] null pointer in printf

From: Premysl Hruby <dfenze_AT_gmail.com>
Date: Mon, 24 May 2010 10:02:47 +0200

Hi,

in sic, if you use cmd ":m something" it will use null pointer as %s in
printf (in function privmsg), which is obviously bad idea (segfault or,
as in case of glibc it send unnecessary string "(null)".

For fix, see patch:

diff -r 503b48b13a77 sic.c
--- a/sic.c Tue Jul 29 19:22:08 2008 +0100
+++ b/sic.c Mon May 24 09:58:32 2010 +0200
@@ -77,8 +77,9 @@
         else if(!strncmp(msg + 1, "l ", 2))
                 snprintf(bufout, sizeof bufout, "PART %s :sic - 250 LOC are too much!\r\n", msg + 3);
         else if(!strncmp(msg + 1, "m ", 2)) {
- if((p = strchr(msg + 3, ' ')))
- *(p++) = 0;
+ if (!(p = strchr(msg + 3, ' ')))
+ return;
+ *(p++) = 0;
                 privmsg(msg + 3, p);
                 return;
         }

-Ph

-- 
Premysl "Anydot" Hruby, http://www.redrum.cz/
-
I'm a signature virus. Please add me to your signature and help me spread!
Received on Mon May 24 2010 - 08:02:47 UTC

This archive was generated by hypermail 2.2.0 : Mon May 24 2010 - 08:12:02 UTC