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

Fix some unlikely segfaults
Author: jgg
Date: 2002-11-06 06:43:14 GMT
Fix some unlikely segfaults

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

+ 3 - 3
apt-pkg/policy.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: policy.cc,v 1.8 2001/05/27 23:40:56 jgg Exp $
+// $Id: policy.cc,v 1.9 2002/11/06 06:43:14 jgg Exp $
 /* ######################################################################
 
    Package Version Policy implementation
@@ -183,7 +183,7 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
    Pin *P = 0;
    
    if (Name.empty() == true)
-      P = &*Defaults.insert(Defaults.end());
+      P = &*Defaults.insert(Defaults.end(),PkgPin());
    else
    {
       // Get a spot to put the pin
@@ -197,7 +197,7 @@ void pkgPolicy::CreatePin(pkgVersionMatch::MatchType Type,string Name,
 	       P = &*I;
 	 
 	 if (P == 0)
-	    P = &*Unmatched.insert(Unmatched.end());      
+	    P = &*Unmatched.insert(Unmatched.end(),PkgPin());      
       }
       else
       {

+ 2 - 2
apt-pkg/tagfile.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: tagfile.cc,v 1.34 2002/07/08 03:39:06 jgg Exp $
+// $Id: tagfile.cc,v 1.35 2002/11/06 06:43:14 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -197,7 +197,7 @@ bool pkgTagSection::Scan(const char *Start,unsigned long MaxLength)
       if (Stop == 0)
 	 return false;
       
-      for (;  Stop+1 < End && Stop[1] == '\r'; Stop++);
+      for (; Stop+1 < End && Stop[1] == '\r'; Stop++);
 
       // Double newline marks the end of the record
       if (Stop+1 < End && Stop[1] == '\n')

+ 2 - 2
apt-pkg/versionmatch.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: versionmatch.cc,v 1.6 2001/06/10 01:57:45 jgg Exp $
+// $Id: versionmatch.cc,v 1.7 2002/11/06 06:43:14 jgg Exp $
 /* ######################################################################
 
    Version Matching 
@@ -68,7 +68,7 @@ pkgVersionMatch::pkgVersionMatch(string Data,MatchType Type) : Type(Type)
 	 else
 	    RelArchive = Data;
 	 
-	 if (RelVerStr.end()[-1] == '*')
+	 if (RelVerStr.length() > 0 && RelVerStr.end()[-1] == '*')
 	 {
 	    RelVerPrefixMatch = true;
 	    RelVerStr = string(RelVerStr.begin(),RelVerStr.end()-1);