makecert: fix a regression with > 2048 bit

When certificates with more than 2048 bits were generated and written to
file the read function used a erroneous calculated length causing the
used buffer to overflow.
This commit is contained in:
Bernhard Miklautz
2017-01-12 15:46:13 +01:00
parent 960f4644cd
commit 8aeb9df0f5

View File

@@ -1073,14 +1073,15 @@ int makecert_context_process(MAKECERT_CONTEXT* context, int argc, char** argv)
break;
}
length = new_len;
x509_str = new_str;
status = BIO_read(bio, &x509_str[offset], length);
status = BIO_read(bio, &x509_str[offset], new_len);
if (status < 0)
break;
length = length + new_len;
offset += status;
}