[xiph-commits] r7860 - icecast/branches/icecast_2_0/src/httpp

karl at motherfish-iii.xiph.org karl at motherfish-iii.xiph.org
Fri Sep 24 13:10:59 PDT 2004


Author: karl
Date: 2004-09-24 13:10:58 -0700 (Fri, 24 Sep 2004)
New Revision: 7860

Modified:
   icecast/branches/icecast_2_0/src/httpp/httpp.c
Log:
backport from trunk, fix buffer overrun


Modified: icecast/branches/icecast_2_0/src/httpp/httpp.c
===================================================================
--- icecast/branches/icecast_2_0/src/httpp/httpp.c	2004-09-24 19:58:17 UTC (rev 7859)
+++ icecast/branches/icecast_2_0/src/httpp/httpp.c	2004-09-24 20:10:58 UTC (rev 7860)
@@ -1,6 +1,9 @@
 /* Httpp.c
 **
 ** http parsing engine
+** 
+** This program is distributed under the GNU General Public License, version 2.
+** A copy of this license is included with this source.
 */
 
 #ifdef HAVE_CONFIG_H
@@ -70,6 +73,8 @@
         if (data[i] == '\n') {
             lines++;
             data[i] = '\0';
+            if (lines >= MAX_HEADERS)
+                return MAX_HEADERS;
             if (i + 1 < len) {
                 if (data[i + 1] == '\n' || data[i + 1] == '\r')
                     break;
@@ -79,7 +84,7 @@
     }
 
     i++;
-    while (data[i] == '\n') i++;
+    while (i < len && data[i] == '\n') i++;
 
     return lines;
 }



More information about the commits mailing list