[devel] [PATCH for apt 22/38] Fix iterators comparison

Aleksei Nikiforov darktemplar на altlinux.org
Вт Дек 10 18:23:27 MSK 2019


---
 apt/methods/ftp.cc | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/apt/methods/ftp.cc b/apt/methods/ftp.cc
index 953febf..00a5502 100644
--- a/apt/methods/ftp.cc
+++ b/apt/methods/ftp.cc
@@ -560,13 +560,16 @@ bool FTPConn::ExtGoPasv()
    string::const_iterator List[4];
    unsigned Count = 0;
    Pos++;
-   for (string::const_iterator I = Msg.begin() + Pos; I < Msg.end(); ++I)
+   if (Pos < Msg.size())
    {
-      if (*I != Msg[Pos])
-	 continue;
-      if (Count >= 4)
-	 return true;
-      List[Count++] = I;
+      for (string::const_iterator I = Msg.begin() + Pos; I != Msg.end(); ++I)
+      {
+         if (*I != Msg[Pos])
+	    continue;
+         if (Count >= 4)
+	    return true;
+         List[Count++] = I;
+      }
    }
    if (Count != 4)
       return true;
-- 
2.24.0



Подробная информация о списке рассылки Devel