crypto/rand/drbg_rand.c:239: error: BUFFER_OVERRUN_L3
  Offset added: 8 Size: [0, +oo].
Showing all 3 steps of the trace


crypto/rand/drbg_rand.c:218:1: <Length trace>
216.    * handle both cases in this function instead.
217.    */
218. > static void ctr_update(DRBG_CTX *dctx,
219.                          const unsigned char *in1, size_t in1len,
220.                          const unsigned char *in2, size_t in2len,

crypto/rand/drbg_rand.c:218:1: Parameter `dctx->ctr.V[*]`
216.    * handle both cases in this function instead.
217.    */
218. > static void ctr_update(DRBG_CTX *dctx,
219.                          const unsigned char *in1, size_t in1len,
220.                          const unsigned char *in2, size_t in2len,

crypto/rand/drbg_rand.c:239:9: Array access: Offset added: 8 Size: [0, +oo]
237.       /* If 192 bit key part of V is on end of K */
238.       if (cctx->keylen == 24) {
239.           memcpy(cctx->V + 8, cctx->V, 8);
               ^
240.           memcpy(cctx->V, cctx->K + 24, 8);
241.       }

static void ctr_update(DRBG_CTX *dctx,
                       const unsigned char *in1, size_t in1len,
                       const unsigned char *in2, size_t in2len,
                       const unsigned char *nonce, size_t noncelen)
{
    DRBG_CTR_CTX *cctx = &dctx->ctr;
    inc_128(cctx);
    AES_encrypt(cctx->V, cctx->K, &cctx->ks);
    if (cctx->keylen != 16) {
        inc_128(cctx);
        AES_encrypt(cctx->V, cctx->K + 16, &cctx->ks);
    }
    inc_128(cctx);
    AES_encrypt(cctx->V, cctx->V, &cctx->ks);
    if (cctx->keylen == 24) {
        memcpy(cctx->V + 8, cctx->V, 8);
        memcpy(cctx->V, cctx->K + 24, 8);
    }
    if (dctx->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
        if (in1 != NULL || nonce != NULL || in2 != NULL)
            ctr_df(cctx, in1, in1len, nonce, noncelen, in2, in2len);
        if (in1len)
            ctr_XOR(cctx, cctx->KX, dctx->seedlen);
    } else {
        ctr_XOR(cctx, in1, in1len);
        ctr_XOR(cctx, in2, in2len);
    }
    AES_set_encrypt_key(cctx->K, dctx->strength, &cctx->ks);
}
['static void ctr_update(DRBG_CTX *dctx,\n                       const unsigned char *in1, size_t in1len,\n                       const unsigned char *in2, size_t in2len,\n                       const unsigned char *nonce, size_t noncelen)\n{\n    DRBG_CTR_CTX *cctx = &dctx->ctr;\n    inc_128(cctx);\n    AES_encrypt(cctx->V, cctx->K, &cctx->ks);\n    if (cctx->keylen != 16) {\n        inc_128(cctx);\n        AES_encrypt(cctx->V, cctx->K + 16, &cctx->ks);\n    }\n    inc_128(cctx);\n    AES_encrypt(cctx->V, cctx->V, &cctx->ks);\n    if (cctx->keylen == 24) {\n        memcpy(cctx->V + 8, cctx->V, 8);\n        memcpy(cctx->V, cctx->K + 24, 8);\n    }\n    if (dctx->flags & RAND_DRBG_FLAG_CTR_USE_DF) {\n        if (in1 != NULL || nonce != NULL || in2 != NULL)\n            ctr_df(cctx, in1, in1len, nonce, noncelen, in2, in2len);\n        if (in1len)\n            ctr_XOR(cctx, cctx->KX, dctx->seedlen);\n    } else {\n        ctr_XOR(cctx, in1, in1len);\n        ctr_XOR(cctx, in2, in2len);\n    }\n    AES_set_encrypt_key(cctx->K, dctx->strength, &cctx->ks);\n}']