]> Pileus Git - ~andy/fetchmail/commitdiff
Validate STAT response more strictly.
authorMatthias Andree <matthias.andree@gmx.de>
Sat, 24 Apr 2010 02:05:16 +0000 (04:05 +0200)
committerMatthias Andree <matthias.andree@gmx.de>
Sat, 24 Apr 2010 04:14:31 +0000 (06:14 +0200)
pop3.c

diff --git a/pop3.c b/pop3.c
index 0cf58da776cbf469ba423919fbe1ce35b72d3185..b1f9621c2d8ce5512ef4ef2633afc49ddb0fcf5c 100644 (file)
--- a/pop3.c
+++ b/pop3.c
@@ -1009,9 +1009,13 @@ static int pop3_getrange(int sock,
     /* get the total message count */
     gen_send(sock, "STAT");
     ok = pop3_ok(sock, buf);
-    if (ok == 0)
-       sscanf(buf,"%d %d", countp, bytes);
-    else
+    if (ok == 0) {
+       int asgn;
+
+       asgn = sscanf(buf,"%d %d", countp, bytes);
+       if (asgn != 2)
+               return PS_PROTOCOL;
+    } else
        return(ok);
 
     /*