Re: Re: Bug#264775: segfaults on hostnames that only have IPv6 addresses

Philipp Kern <[email protected]>
Newsgroups gmane.network.irc.bopm
Organization 0x539.de
Message-ID <[email protected]>
tags 264775 +patch
thanks

On Di, 2004-08-24 at 00:31, Erik Fears wrote:
> > However, I still think a segfault is a bug. A program shouldn't segfault
> > when it receives invalid data.
> Feel free to submit a patch.

Elan Ruusamäe <[email protected]> stated on the mailing list that he submitted one.

The relevant part:
Index: src/scan.c
===================================================================
RCS file: /data/cvs/bopm/src/scan.c,v
retrieving revision 1.33
diff -u -r1.33 scan.c
--- src/scan.c  22 Jun 2003 17:05:30 -0000      1.33
+++ src/scan.c  9 Jul 2004 14:31:26 -0000
@@ -423,12 +430,14 @@
                      continue;
                      break;
                   case OPM_ERR_BADADDR:
+                     // ss->manual_target could be NULL, happens when making invalid regex, and segfaults suck
+                     // -glen 2004-04-17
                      log_printf("OPM -> Bad address %s [%s].",
-                           ss->manual_target->name, ss->ip);
+                           ss->manual_target ? ss->manual_target->name : "SERVER", ss->ip);
                      break;
                   default:
                      log_printf("OPM -> Unknown error %s [%s].",
-                           ss->manual_target->name, ss->ip);
+                           ss->manual_target ? ss->manual_target->name : "SERVER", ss->ip);
                      break;
                }
             }

I wasn't able to test it, though. If you give your ok Eric, it could be
incorporated in at least the Debian version of BOPM to fix this bug.

Regards,
Philipp Kern
Blitzed IRC Network
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.