httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/support ab.c
Date Sun, 01 Sep 2002 21:11:17 GMT
brianp      2002/09/01 14:11:17

  Modified:    support  ab.c
  Log:
  Eliminated some fixed-size buffers that didn't have proper overflow checks
  
  Revision  Changes    Path
  1.120     +19 -25    httpd-2.0/support/ab.c
  
  Index: ab.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/support/ab.c,v
  retrieving revision 1.119
  retrieving revision 1.120
  diff -u -r1.119 -r1.120
  --- ab.c	1 Sep 2002 06:25:42 -0000	1.119
  +++ ab.c	1 Sep 2002 21:11:17 -0000	1.120
  @@ -288,19 +288,18 @@
   char servername[1024];		/* name that server reports */
   char *hostname;			/* host name from URL */
   char *host_field;		/* value of "Host:" header field */
  -char path[1024];		/* path name */
  +char *path;                     /* path name */
   char postfile[1024];		/* name of file containing post data */
   char *postdata;			/* *buffer containing data from postfile */
   apr_size_t postlen = 0;		/* length of data to be POSTed */
   char content_type[1024];	/* content type to put in POST header */
  -char cookie[1024],		/* optional cookie line */
  -     auth[1024],		/* optional (basic/uuencoded)
  -				 * authentification */
  -     hdrs[4096];		/* optional arbitrary headers */
  +char *cookie,                   /* optional cookie line */
  +     *auth,                     /* optional (basic/uuencoded) auhentication */
  +     *hdrs;                     /* optional arbitrary headers */
   apr_port_t port;		/* port number */
   char proxyhost[1024];		/* proxy host name */
   int proxyport = 0;		/* proxy port */
  -char connecthost[1024];
  +char *connecthost;
   apr_port_t connectport;
   char *gnuplot;			/* GNUplot file */
   char *csvperc;			/* CSV Percentile file */
  @@ -1563,11 +1562,11 @@
   #endif
   
       if (isproxy) {
  -	strcpy(connecthost, proxyhost);
  +	connecthost = apr_pstrdup(cntxt, proxyhost);
   	connectport = proxyport;
       }
       else {
  -	strcpy(connecthost, hostname);
  +	connecthost = apr_pstrdup(cntxt, hostname);
   	connectport = port;
       }
   
  @@ -1869,7 +1868,7 @@
       if (rv != APR_SUCCESS || !hostname || scope_id) {
   	return 1;
       }
  -    strcpy(path, cp);
  +    path = apr_pstrdup(cntxt, cp);
       *cp = '\0';
       if (*url == '[') {		/* IPv6 numeric address string */
   	host_field = apr_psprintf(cntxt, "[%s]", hostname);
  @@ -1959,10 +1958,10 @@
       tablestring = "";
       trstring = "";
       tdstring = "bgcolor=white";
  -    cookie[0] = '\0';
  -    auth[0] = '\0';
  +    cookie = "";
  +    auth = "";
       proxyhost[0] = '\0';
  -    hdrs[0] = '\0';
  +    hdrs = "";
   
       apr_app_initialize(&argc, &argv, NULL);
       atexit(apr_terminate);
  @@ -2056,9 +2055,7 @@
   	    strcpy(content_type, optarg);
   	    break;
   	case 'C':
  -	    strncat(cookie, "Cookie: ", sizeof(cookie));
  -	    strncat(cookie, optarg, sizeof(cookie));
  -	    strncat(cookie, "\r\n", sizeof(cookie));
  +            cookie = apr_pstrcat(cntxt, "Cookie: ", optarg, "\r\n", NULL);
   	    break;
   	case 'A':
   	    /*
  @@ -2070,9 +2067,8 @@
   	    l = apr_base64_encode(tmp, optarg, strlen(optarg));
   	    tmp[l] = '\0';
   
  -	    strncat(auth, "Authorization: Basic ", sizeof(auth));
  -	    strncat(auth, tmp, sizeof(auth));
  -	    strncat(auth, "\r\n", sizeof(auth));
  +            auth = apr_pstrcat(cntxt, auth, "Authorization: Basic ", tmp,
  +                               "\r\n", NULL);
   	    break;
   	case 'P':
   	    /*
  @@ -2083,13 +2079,11 @@
   	    l = apr_base64_encode(tmp, optarg, strlen(optarg));
   	    tmp[l] = '\0';
   
  -	    strncat(auth, "Proxy-Authorization: Basic ", sizeof(auth));
  -	    strncat(auth, tmp, sizeof(auth));
  -	    strncat(auth, "\r\n", sizeof(auth));
  +            auth = apr_pstrcat(cntxt, auth, "Proxy-Authorization: Basic ",
  +                               tmp, "\r\n", NULL);
   	    break;
   	case 'H':
  -	    strncat(hdrs, optarg, sizeof(hdrs));
  -	    strncat(hdrs, "\r\n", sizeof(hdrs));
  +            hdrs = apr_pstrcat(cntxt, hdrs, optarg, "\r\n", NULL);
   	    break;
   	case 'w':
   	    use_html = 1;
  
  
  

Mime
View raw message