Просмотр исходного кода

Fixed another oops
Author: jgg
Date: 1999-01-31 21:52:27 GMT
Fixed another oops

Arch Librarian лет назад: 22
Родитель
Сommit
f3bcc38396
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      apt-pkg/tagfile.cc

+ 4 - 4
apt-pkg/tagfile.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // Description								/*{{{*/
-// $Id: tagfile.cc,v 1.21 1999/01/31 07:01:11 jgg Exp $
+// $Id: tagfile.cc,v 1.22 1999/01/31 21:52:27 jgg Exp $
 /* ######################################################################
 /* ######################################################################
 
 
    Fast scanner for RFC-822 type header information
    Fast scanner for RFC-822 type header information
@@ -139,7 +139,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
       return false;
       return false;
    
    
    TagCount = 0;
    TagCount = 0;
-   while (TagCount < sizeof(Indexes)/sizeof(Indexes[0]))
+   while (TagCount < sizeof(Indexes)/sizeof(Indexes[0]) && Stop < End)
    {
    {
       // Start a new index and add it to the hash
       // Start a new index and add it to the hash
       if (isspace(Stop[0]) == 0)
       if (isspace(Stop[0]) == 0)
@@ -157,8 +157,8 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
 	 return false;
 	 return false;
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
       for (; Stop[1] == '\r' && Stop+1 < End; Stop++);
 
 
-      // Double newline or end of file marks the end of the record
-      if (Stop+1 >= End || Stop[1] == '\n')
+      // Double newline marks the end of the record
+      if (Stop+1 < End && Stop[1] == '\n')
       {
       {
 	 Indexes[TagCount] = Stop - Section;
 	 Indexes[TagCount] = Stop - Section;
 	 for (; (Stop[0] == '\n' || Stop[0] == '\r') && Stop < End; Stop++);
 	 for (; (Stop[0] == '\n' || Stop[0] == '\r') && Stop < End; Stop++);