httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/file_io/unix readwrite.c
Date Thu, 04 Nov 1999 07:24:24 GMT
manoj       99/11/03 23:24:24

  Modified:    src/lib/apr/file_io/unix readwrite.c
  Log:
  a rewrite of ap_fprintf that fixes a potential buffer overflow, a memory
  leak, and more.
  
  Revision  Changes    Path
  1.15      +5 -15     apache-2.0/src/lib/apr/file_io/unix/readwrite.c
  
  Index: readwrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -d -u -r1.14 -r1.15
  --- readwrite.c	1999/10/24 19:23:55	1.14
  +++ readwrite.c	1999/11/04 07:24:23	1.15
  @@ -356,28 +356,18 @@
   {
       int cc;
       va_list ap;
  -    ap_vformatter_buff_t vbuff;
       char *buf;
  -    ap_ssize_t len;
  +    int len;
   
       buf = malloc(HUGE_STRING_LEN);
       if (buf == NULL) {
           return 0;
       }
  -    /* save one byte for nul terminator */
  -    vbuff.curpos = buf;
  -    vbuff.endpos = buf + len - 1;
       va_start(ap, format);
  -#if 0
  -    cc = ap_vformatter(printf_flush, &vbuff, format, ap);
  -    va_end(ap);
  -    *vbuff.curpos = '\0';
  -#endif
  -    vsprintf(buf, format, ap);
  -    len = strlen(buf);
  -    cc = ap_write(fptr, buf, &len);
  +    len = ap_vsnprintf(buf, HUGE_STRING_LEN, format, ap);
  +    cc = ap_puts(buf, fptr);
       va_end(ap);
  -    return (cc == -1) ? len : cc;
  +    free(buf);
  +    return (cc == APR_SUCCESS) ? len : -1;
   }
  -
   
  
  
  

Mime
View raw message