fixed off-by-one bug when encoding serial number as ASN.1

This commit is contained in:
John Safranek
2012-05-09 16:40:36 -07:00
parent 59e0181c8d
commit 07990acaa6

View File

@@ -4119,7 +4119,7 @@ static int SetSerialNumber(const byte* sn, word32 snSz, byte* output)
if (snSz <= EXTERNAL_SERIAL_SIZE) { if (snSz <= EXTERNAL_SERIAL_SIZE) {
output[0] = ASN_INTEGER; output[0] = ASN_INTEGER;
output[1] = snSz; output[1] = snSz + 1;
output[2] = 0; output[2] = 0;
XMEMCPY(&output[3], sn, snSz); XMEMCPY(&output[3], sn, snSz);
result = snSz + 3; result = snSz + 3;