From: Darren Nickerson Date: Sun, 9 Feb 2003 02:36:26 +0000 (+0000) Subject: [Bug 381] Str.h assert problem X-Git-Tag: HYLAFAX-4_1_6BETA1~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8563b2a1486661ca2d00a85cd8f02f1e3b9c1154;p=thirdparty%2FHylaFAX.git [Bug 381] Str.h assert problem Patch to fix topDomain subroutine contributed by John Gilman. --- diff --git a/hfaxd/InetFaxServer.c++ b/hfaxd/InetFaxServer.c++ index b90cdf4d..39c8fd30 100644 --- a/hfaxd/InetFaxServer.c++ +++ b/hfaxd/InetFaxServer.c++ @@ -126,18 +126,19 @@ InetFaxServer::open(void) static const char* topDomain(const fxStr& h) { - char* maybe = NULL; int dots = 0; u_int l = h.length(); + + if(l <= 0) return(NULL); // out early + for (;;) { l = h.nextR(l, '.'); if (l == 0) - break; + return (&h[0]); // return whole string if (++dots == 2) return (&h[l]); - maybe = &h[l]; + l -=1; //back over the dot } - return (maybe); } /*