Skip to content

pkcs7: fix error check of PKCS7_SIGNER_INFO_set()#1040

Open
ndossche wants to merge 1 commit intoruby:masterfrom
ndossche:clesss-13
Open

pkcs7: fix error check of PKCS7_SIGNER_INFO_set()#1040
ndossche wants to merge 1 commit intoruby:masterfrom
ndossche:clesss-13

Conversation

@ndossche
Copy link
Copy Markdown
Contributor

This function returns <=0 on error, not only 0.
This is evident by looking at the implementation where it can return a negative error here [1]. Use in OpenSSL itself also uses the <=0 check [2].

[1] https://github.com/openssl/openssl/blob/087bddcda9973671d52f94e63db32bfd6001fd1b/crypto/pkcs7/pk7_lib.c#L378-L381
[2] https://github.com/openssl/openssl/blob/087bddcda9973671d52f94e63db32bfd6001fd1b/crypto/pkcs7/pk7_lib.c#L414

This was found by a hybrid static-dynamic analyser that looks for inconsistent handling of error checks in bindings.

This function returns <=0 on error, not only 0.
This is evident by looking at the implementation where it can return a
negative error here [1]. Use in OpenSSL itself also uses the <=0 check [2].

[1] https://github.com/openssl/openssl/blob/087bddcda9973671d52f94e63db32bfd6001fd1b/crypto/pkcs7/pk7_lib.c#L378-L381
[2] https://github.com/openssl/openssl/blob/087bddcda9973671d52f94e63db32bfd6001fd1b/crypto/pkcs7/pk7_lib.c#L414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant