dgaudet     98/03/07 13:39:30

  Modified:    src/main util_uri.c
               src/include httpd.h
  Log:
  Don't use strtoul.  And defend against similar slipups in the future... I
  know that define in httpd.h may annoy module authors...
  
  Revision  Changes    Path
  1.8       +4 -2      apache-1.3/src/main/util_uri.c
  
  Index: util_uri.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util_uri.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- util_uri.c        1998/03/03 08:17:21     1.7
  +++ util_uri.c        1998/03/07 21:39:28     1.8
  @@ -520,9 +520,11 @@
            uptr->port_str = pstrndup (p, uptr->hostinfo+match[7].rm_so, 
match[7].rm_eo - match[7].rm_so);
            if (uptr->port_str[0] != '\0') {
                char *endstr;
  +             int port;
   
  -             uptr->port = strtoul(uptr->port_str, &endstr, 10);
  -             if (*endstr != '\0') {
  +             port = strtol(uptr->port_str, &endstr, 10);
  +             uptr->port = port;
  +             if (*endstr != '\0' || uptr->port != port) {
                    /* Invalid characters after ':' found */
                    return HTTP_BAD_REQUEST;
                }
  
  
  
  1.194     +6 -0      apache-1.3/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/httpd.h,v
  retrieving revision 1.193
  retrieving revision 1.194
  diff -u -r1.193 -r1.194
  --- httpd.h   1998/03/06 07:50:58     1.193
  +++ httpd.h   1998/03/07 21:39:30     1.194
  @@ -979,4 +979,10 @@
   
   API_EXPORT(extern const char *) psignature(const char *prefix, request_rec 
*r);
   
  +/* strtoul does not exist on sunos4. */
  +#ifdef strtoul
  +#undef strtoul
  +#endif
  +#define strtoul strtoul_is_not_a_portable_function_use_strtol_instead
  +
   #endif       /* !APACHE_HTTPD_H */
  
  
  

Reply via email to