Prevent further segmentation faults in parse.c
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Tue, 16 Feb 2010 23:38:02 +0100
changeset 45 535478a0f482
parent 44 f08e8fb2c1da
child 46 08ad49ca1b4e
Prevent further segmentation faults in parse.c Some critical parts in parse.c depend on parseable data in message->user and message->email. These values will never be NULL and will never again result in a segmentation fault. committer: Markus Bröker <mbroeker@largo.homelinux.org>
src/parse.c
--- a/src/parse.c
+++ b/src/parse.c
@@ -80,6 +80,15 @@
     struct tm *timeptr;
 
     /*
+     * make sure that parseable data is available
+     * this prevents a possible segmentation fault
+     */
+    if (message->user == NULL)
+        message->user = "error";
+    if (message->email == NULL)
+        message->email = "server.err";
+
+    /*
      * default message
      */
     snprintf (msg, sizeof (msg), "PRIVMSG %s :%s.\r\n", message->channel, gettext ("Request cannot be performed"));