Skip to content

Commit 8c40e86

Browse files
Merge pull request #135 from lealem47/i2d_x509
Handle potential pointer increment in wolfSSL_i2d_X509
2 parents 4330d7c + 2491763 commit 8c40e86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/x509/clu_cert_setup.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,13 +786,15 @@ int wolfCLU_certSetup(int argc, char** argv)
786786
/* write out certificate */
787787
if (ret == WOLFCLU_SUCCESS && !nooutFlag) {
788788
byte* derBuf = inBuf;
789+
byte* pt; /* use pt with i2d to handle potential pointer increment */
789790
int derBufSz = inBufSz;
790791

791792
/* if inform is PEM we convert to DER for excluding input that is not
792793
* part of the certificate */
793794
if (inForm == PEM_FORM) {
794795
if (reqFlag) {
795-
derBufSz = wolfSSL_i2d_X509(x509, &derBuf);
796+
pt = derBuf;
797+
derBufSz = wolfSSL_i2d_X509(x509, &pt);
796798
}
797799
else {
798800
derBuf = derObj->buffer;

0 commit comments

Comments
 (0)