Fix a couple of code paths on which, if fxp_readdir returned an error,
[sgt/putty] / sshrsa.c
index 0c1b2ef..163a92b 100644 (file)
--- a/sshrsa.c
+++ b/sshrsa.c
@@ -110,7 +110,7 @@ static void sha512_mpint(SHA512_State * s, Bignum b)
        lenbuf[0] = bignum_byte(b, len);
        SHA512_Bytes(s, lenbuf, 1);
     }
-    memset(lenbuf, 0, sizeof(lenbuf));
+    smemclr(lenbuf, sizeof(lenbuf));
 }
 
 /*
@@ -526,6 +526,8 @@ static void getstring(char **data, int *datalen, char **p, int *length)
     if (*datalen < 4)
        return;
     *length = GET_32BIT(*data);
+    if (*length < 0)
+        return;
     *datalen -= 4;
     *data += 4;
     if (*datalen < *length)