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


crypto/rand/drbg_ctr.c:199:1: <Length trace>
197.    * so we handle both cases in this function instead.
198.    */
199. > static void ctr_update(RAND_DRBG *drbg,
200.                          const unsigned char *in1, size_t in1len,
201.                          const unsigned char *in2, size_t in2len,

crypto/rand/drbg_ctr.c:199:1: Parameter `drbg->data.ctr.V[*]`
197.    * so we handle both cases in this function instead.
198.    */
199. > static void ctr_update(RAND_DRBG *drbg,
200.                          const unsigned char *in1, size_t in1len,
201.                          const unsigned char *in2, size_t in2len,

crypto/rand/drbg_ctr.c:220:9: Array access: Offset added: 8 Size: [0, +oo]
218.       /* If 192 bit key part of V is on end of K */
219.       if (ctr->keylen == 24) {
220.           memcpy(ctr->V + 8, ctr->V, 8);
               ^
221.           memcpy(ctr->V, ctr->K + 24, 8);
222.       }

static void ctr_update(RAND_DRBG *drbg,
                       const unsigned char *in1, size_t in1len,
                       const unsigned char *in2, size_t in2len,
                       const unsigned char *nonce, size_t noncelen)
{
    RAND_DRBG_CTR *ctr = &drbg->data.ctr;
    inc_128(ctr);
    AES_encrypt(ctr->V, ctr->K, &ctr->ks);
    if (ctr->keylen != 16) {
        inc_128(ctr);
        AES_encrypt(ctr->V, ctr->K + 16, &ctr->ks);
    }
    inc_128(ctr);
    AES_encrypt(ctr->V, ctr->V, &ctr->ks);
    if (ctr->keylen == 24) {
        memcpy(ctr->V + 8, ctr->V, 8);
        memcpy(ctr->V, ctr->K + 24, 8);
    }
    if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {
        if (in1 != NULL || nonce != NULL || in2 != NULL)
            ctr_df(ctr, in1, in1len, nonce, noncelen, in2, in2len);
        if (in1len)
            ctr_XOR(ctr, ctr->KX, drbg->seedlen);
    } else {
        ctr_XOR(ctr, in1, in1len);
        ctr_XOR(ctr, in2, in2len);
    }
    AES_set_encrypt_key(ctr->K, drbg->strength, &ctr->ks);
}
['static void ctr_update(RAND_DRBG *drbg,\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    RAND_DRBG_CTR *ctr = &drbg->data.ctr;\n    inc_128(ctr);\n    AES_encrypt(ctr->V, ctr->K, &ctr->ks);\n    if (ctr->keylen != 16) {\n        inc_128(ctr);\n        AES_encrypt(ctr->V, ctr->K + 16, &ctr->ks);\n    }\n    inc_128(ctr);\n    AES_encrypt(ctr->V, ctr->V, &ctr->ks);\n    if (ctr->keylen == 24) {\n        memcpy(ctr->V + 8, ctr->V, 8);\n        memcpy(ctr->V, ctr->K + 24, 8);\n    }\n    if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) {\n        if (in1 != NULL || nonce != NULL || in2 != NULL)\n            ctr_df(ctr, in1, in1len, nonce, noncelen, in2, in2len);\n        if (in1len)\n            ctr_XOR(ctr, ctr->KX, drbg->seedlen);\n    } else {\n        ctr_XOR(ctr, in1, in1len);\n        ctr_XOR(ctr, in2, in2len);\n    }\n    AES_set_encrypt_key(ctr->K, drbg->strength, &ctr->ks);\n}']