Fix a regression introduced with the previous commit.
authorFabian Keil <fk@fabiankeil.de>
Sun, 28 Mar 2010 18:02:22 +0000 (18:02 +0000)
committerFabian Keil <fk@fabiankeil.de>
Sun, 28 Mar 2010 18:02:22 +0000 (18:02 +0000)
The (url_param[0] != '\0') check wasn't supposed to prevent
strstr() from segfaulting (which makes no sense), but to detect
whether or not an URL has been specified.

'Optimizing' it away was thus a dumb move.

cgisimple.c

index 11781bd..46ffb15 100644 (file)
@@ -1,4 +1,4 @@
-const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.97 2010/03/07 12:07:51 fabiankeil Exp $";
+const char cgisimple_rcs[] = "$Id: cgisimple.c,v 1.98 2010/03/27 18:29:59 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/cgisimple.c,v $
@@ -1105,8 +1105,9 @@ jb_err cgi_show_url_info(struct client_state *csp,
          url_param[0] = '\0';
       }
    }
-   else if ((NULL == strstr(url_param, "://")
-         || (strstr(url_param, "://") > strstr(url_param, "/"))))
+   else if ((url_param[0] != '\0')
+      && ((NULL == strstr(url_param, "://")
+            || (strstr(url_param, "://") > strstr(url_param, "/")))))
    {
       /*
        * No prefix or at least no prefix before