httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject [PATCH] strtok sucks
Date Mon, 28 Apr 1997 05:57:36 GMT
This patch fixes the problem without sucking too much.

.....Roy

Index: util_script.c
===================================================================
RCS file: /export/home/cvs/apache/src/util_script.c,v
retrieving revision 1.54
diff -c -r1.54 util_script.c
*** util_script.c	1997/04/28 01:40:58	1.54
--- util_script.c	1997/04/28 05:43:39
***************
*** 76,85 ****
                            char *av0, const char *reqargs)
  {
      char **av;
!     char *t;
      char *args = pstrdup(p, reqargs);
      int idx = 0;
-     char *strtok_arg = args;
  
      av = (char **)palloc(p, APACHE_ARG_MAX * sizeof(char *));
      
--- 76,84 ----
                            char *av0, const char *reqargs)
  {
      char **av;
!     char *tok;
      char *args = pstrdup(p, reqargs);
      int idx = 0;
  
      av = (char **)palloc(p, APACHE_ARG_MAX * sizeof(char *));
      
***************
*** 92,101 ****
  
      av[idx++] = av0;
      
!     while ((idx < APACHE_ARG_MAX) && ((t = strtok(strtok_arg, "+")) != NULL))
{
!         strtok_arg = NULL;
! 	unescape_url(t);
! 	av[idx++] = escape_shell_cmd(p, t);
      }
  
      av[idx] = NULL;
--- 91,105 ----
  
      av[idx++] = av0;
      
!     while ((idx < APACHE_ARG_MAX) && *args) {
!         tok = args;
!         while (*args && *args != '+') ++args;
!         if (*args == '+') {
!             *args = '\0';
!             ++args;
!         }
!         unescape_url(tok);
!         av[idx++] = escape_shell_cmd(p, tok);
      }
  
      av[idx] = NULL;

Mime
View raw message