Language: C
Label: vulnerable
CWE: CWE-120 \u2014 Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer, leading to a buffer overflow.

Code:
unknown_layer_handler(TSS2_RC rc)
{
    static __thread char buf[32];

    clearbuf(buf);
    catbuf(buf, "0x%X", tpm2_error_get(rc));

    return buf;
}