Language: C
Label: vulnerable
CWE: CWE-190 \u2014 Integer Overflow or Wraparound
The product performs a calculation that can produce an integer overflow or wraparound, when the logic assumes that the resulting value will always be larger than the original value. This can introduce other weaknesses when the calculation is used for resource management or execution control.

Code:
void ep2_map_dst(ep2_t p, const uint8_t *msg, int len, const uint8_t *dst, int dst_len) {

        /* enough space for two field elements plus extra bytes for uniformity */
        const int len_per_elm = (FP_PRIME + ep_param_level() + 7) / 8;
        uint8_t *pseudo_random_bytes = RLC_ALLOCA(uint8_t, 4 * len_per_elm);

        RLC_TRY {

                /* XXX(rsw) See note in ep/relic_ep_map.c about using MD_MAP. */
                /* hash to a pseudorandom string using md_xmd */
                md_xmd(pseudo_random_bytes, 4 * len_per_elm, msg, len, dst, dst_len);
                ep2_map_from_field(p, pseudo_random_bytes, 2 * len_per_elm);
        }
        RLC_CATCH_ANY {
                RLC_THROW(ERR_CAUGHT);
        }
        RLC_FINALLY {
                RLC_FREE(pseudo_random_bytes);
        }
}