httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-2.0/server protocol.c
Date Thu, 22 Apr 2004 22:38:03 GMT
gregames    2004/04/22 15:38:03

  Modified:    server   protocol.c
  Log:
  ap_rgetline_core: insure that the output string is null terminated
  when exiting with APR_ENOSPC
  
  Submitted by: Tsurutani Naoki <turutani scphys.kyoto-u.ac.jp>
  
  Revision  Changes    Path
  1.148     +11 -0     httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -d -b -u -r1.147 -r1.148
  --- protocol.c	21 Apr 2004 21:57:19 -0000	1.147
  +++ protocol.c	22 Apr 2004 22:38:03 -0000	1.148
  @@ -251,6 +251,15 @@
               /* Would this overrun our buffer?  If so, we'll die. */
               if (n < bytes_handled + len) {
                   *read = bytes_handled;
  +                if (*s) {
  +                    /* ensure this string is terminated */
  +                    if (bytes_handled < n) {
  +                        (*s)[bytes_handled] = '\0';
  +                    }
  +                    else {
  +                        (*s)[n-1] = '\0';
  +                    }
  +                }
                   return APR_ENOSPC;
               }
               
  @@ -379,6 +388,8 @@
                   /* Do we have enough space? We may be full now. */
                   if (bytes_handled >= n) {
                       *read = n;
  +                    /* ensure this string is terminated */
  +                    (*s)[n-1] = '\0';
                       return APR_ENOSPC;
                   }
                   else {
  
  
  

Mime
View raw message