PR: 2522
authorDr. Stephen Henson <steve@openssl.org>
Mon, 23 May 2011 12:27:43 +0000 (12:27 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 23 May 2011 12:27:43 +0000 (12:27 +0000)
Submitted by: Henrik Grindal Bakken <henribak@cisco.com>

Don't compare past end of buffer.

fips/rand/fips_drbg_lib.c

index 7892a02..46f059d 100644 (file)
@@ -145,7 +145,7 @@ static size_t fips_get_entropy(DRBG_CTX *dctx, unsigned char **pout,
        if (rv < (min_len + bl) || (rv % bl))
                return 0;
        /* Compare consecutive blocks for continuous PRNG test */
-       for (p = tout; p < tout + rv; p += bl)
+       for (p = tout; p < tout + rv - bl; p += bl)
                {
                if (!memcmp(p, p + bl, bl))
                        {