Skip to contentSkip to conversation

sample-plugins: fix ASN1_STRING_to_UTF8 return value checks

PATCH In review Steffan Karger 2 participants 3 messages Jul 28, 2017 – Aug 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sample-plugins: fix ASN1_STRING_to_UTF8 return value checks

As we did in 2d032c7f for the ASN1_STRING_to_UTF8() calls in the core code, we should also free(buf) if the function returns 0.

---
 .../keying-material-exporter-demo/keyingmaterialexporter.c              | 2 +-
 sample/sample-plugins/log/log_v3.c                                      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
sample/sample-plugins/keying-material-exporter-demo/keyingmaterialexporter.c +1 -1
index 44a8c02..c483907 100644
@@ -143,7 +143,7 @@ session_user_set(struct session *sess, X509 *x509)
             continue;
         }
         unsigned char *buf = NULL;
-        if (ASN1_STRING_to_UTF8(&buf, val) <= 0)
+        if (ASN1_STRING_to_UTF8(&buf, val) < 0)
         {
             continue;
         }
sample/sample-plugins/log/log_v3.c +1 -1
index 12da624..98d80d9 100644
@@ -227,7 +227,7 @@ x509_print_info(X509 *x509crt)
         {
             continue;
         }
-        if (ASN1_STRING_to_UTF8(&buf, val) <= 0)
+        if (ASN1_STRING_to_UTF8(&buf, val) < 0)
         {
             continue;
         }
Signature · 1 line
2.7.4
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

ACK. I have a slightly modified version of this patch pending for release/2.4 (which lacks the OpenSSL 0.9.6b workaround removal). This will be considered to be added a bit later.

Your patch has been applied to the master branch

commit c43045ca0590364552fbd060cc65ee1c50a4866a

Author: Steffan Karger
Date:   Fri Jul 28 12:38:22 2017 +0200
     sample-plugins: fix ASN1_STRING_to_UTF8 return value checks

     Signed-off-by: Steffan Karger <[email protected]...>
     Acked-by: David Sommerseth <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg15161.html
     Signed-off-by: David Sommerseth <[email protected]...>

- --
kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBCgAGBQJZkax0AAoJEIbPlEyWcf3ytLkQAIojuE34qq8HN2UTkIPoEDNz /LUzFJjLovzMEibI3Q1g8h3MkSlEi0ar6CHo1X4q4uXoD6dkb6K7Ccy2iU4HglqU rQtrjU/0tC/iVHmdRayhJc7aez4QIbovIfRuamA0dqC4zoEZutMRrbHF4prRy7Lc VFprsfEjJPV8yRvEfU34PWHaxFehU8l/9P530oMPeO+mFG0oKP7FCaYbgmV9KZLF CxjbHY8ZdEXQ++GBmKa/vklsdxb+QF03OoDTmNvqM5YqaCHsWkAxesu5ESwpJomC pkfG2dSd/0WZI8vuw02sgOAGDPXx5+rNSFpg2eDbynhC1w30lk9w5e281ViyDMcl h1DrLyP+MTMhIPYYQ5bZSwyct5Mwao+biGxdFmtnTOn1zWrG4M8d4uSA6Sf0pu2b /u+68KxrHG5/yra3RyTTIza4fCdLUVriepAQAqtHXlPSyGwKS8/eFzlzrFbFhEa8 iDeHJvtQSyPQvt/N3sprvtIKnv88GS3orrpEdDtFJYL2KSVJ4eb2mXKgYqkSDhL0 2KADnwl9cOmiHKBYKPq515GI6b6i63CmLmO32wXh44yU00k26vLfEX8s3ItOWlRD eJi7t1R8sZm1IJWmZM3AHsv+5h+Kn84f8YZit/fiZJivIREMb5LAVS/h9ZqBMyNX 4LgYGutbSjKU+fSrG2JB
=KULp
-----END PGP SIGNATURE-----

Acked-by on v1 1/1
#2 lore raw
In reply to Steffan Karger

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

This is the slightly modified commit, which resolves the merge conflict when cherry-picking the corresponding commit from git master (c43045ca059).

Below is the complete commit message.

commit 5ed5030c349326c5448fd87424c1a2283ccee18f (release/2.4)

Author: David Sommerseth
Date:   Mon Aug 14 15:19:37 2017 +0200

sample-plugins: fix ASN1_STRING_to_UTF8 return value checks

As we did in 2d032c7f for the ASN1_STRING_to_UTF8() calls in the core code, we should also free(buf) if the function returns 0.

[DS: On-the-fly merge conflict fix:
There was a conflict against the OpenSSL 0.9.6b workaround in v2.4. Since we no longer support anything older than OpenSSL 0.9.8 in release/2.4, whack that workaround and be more consistent with git master those two places]

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg15161.html

(cherry picked from commit c43045ca0590364552fbd060cc65ee1c50a4866a)

- --
kind regards,

David Sommerseth

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBCgAGBQJZkcvWAAoJEIbPlEyWcf3yka4P/jCrg3SkgPEGZxmWOU4RGQlh VSlcq64qKGggg7wEcG/G0UYCdiPwUT1zD0s/cFoJPNG/qSeX8D8LWOJosu41ISwH aTU8j6oQ/WCA3xLbi9gLL67Aq7IlEoclQF56YUzAfyAYfF1eDmaJ2L8OlwYPlvQO PAPYVKE/wHWXUaTa6xbgQJmL7evHg/Jr4ThnoOPGgrTwNPZFso4yrECd87wmhnXT yjyypzrh/XEgQLMdo09LYyReLYAmOKx7BlmR9sXcp3JiXctwtd8//lSUoX8XrtlG mNVzKBlWlzN4oPO0Llel33tuiSm4kGE7EQKbFzDx2Q6acEsvEmkVljILZ5Pe0MBi wpT9hNcGr5/mImXEcm0Ga/z/qKLTlrgQJBiKmn6WOfaFFuGKWSqtN5MzpW1MPDwc IUoPnlI/UaM86pLJqtq8+7/sAkM7V6H7zX9sMcz6JNi4HxdLIJg/ziL4qnRqU8ZA 88UOsY+2UnW4aJKZOkpNbGJiyUtUMn+NBwwd4tXsw5PXkh/Usjkyqhl5uGGTFEzu rJgHkwE89R6C9NYEvzC5u85pe8yMZ/eJtywIwate+G7BST/KU98Bfyxbpe9eMjzo qfewluWhHFzQaUSnSRk6jvzWCe3dr21nCyZM/ku9xKdI+vrmY0IwIjl8Haa2rAvD VEXemEB5tgG8jxqPP7z7
=zosr
-----END PGP SIGNATURE-----