diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index aca9132e7..c87589707 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -26227,8 +26227,10 @@ static int SetReqAttribSingle(byte* output, int* idx, char* attr, int attrSz, if (strSz > 0) { XMEMCPY(&output[*idx], str, strSz); *idx += strSz; - XMEMCPY(&output[*idx], attr, attrSz); - *idx += attrSz; + if (attrSz > 0) { + XMEMCPY(&output[*idx], attr, attrSz); + *idx += attrSz; + } } } return totalSz;