summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorschwarze <>2020-07-23 17:15:35 +0000
committerschwarze <>2020-07-23 17:15:35 +0000
commit006d896f4376dbbbff0a958d5fe8639ab0c070d5 (patch)
treec8fd156c6634db94fcd09f8530f24d6fe60371b3 /src/lib/libcrypto/man
parentf9151c76d47b4d5c6c4e171b7c4d485a6ff5dd12 (diff)
downloadopenbsd-006d896f4376dbbbff0a958d5fe8639ab0c070d5.tar.gz
openbsd-006d896f4376dbbbff0a958d5fe8639ab0c070d5.tar.bz2
openbsd-006d896f4376dbbbff0a958d5fe8639ab0c070d5.zip
Fix a bug in PEM_X509_INFO_read_bio(3) that is very likely to cause
use-after-free and double-free issues in calling programs. The bug was introduced in SSLeay-0.6.0 released on June 21, 1996 and has been present since OpenBSD 2.4. I found the bug while documenting the function. The bug could bite in two ways that looked quite different from the perspective of the calling code: * If a stack was passed in that already contained some X509_INFO objects and an error occurred, all the objects passed in would be freed, but without removing the freed pointers from the stack, so the calling code would probable continue to access the freed pointers and eventually free them a second time. * If the input BIO contained at least two valid PEM objects followed by at least one PEM object causing an error, at least one freed pointer would be put onto the stack, even though the function would return NULL rather than the stack. But the calling code would still have a pointer to the stack, so it would be likely to access the new bogus pointers sooner or later. Fix all this by remembering the size of the input stack on entry and cutting it back to exactly that size when exiting due to an error, but no further. While here, do some related cleanup: * Garbage collect the automatic variables "error" and "i" which were only used at one single place each. * Use NULL rather than 0 for pointers. I like bugfixes that make the code four lines shorter, reduce the number of variables by one, reduce the number of brace-blocks by one, reduce the number if if-statements by one, and reduce the number of else-clauses by one. Tweaks and OK tb@.
Diffstat (limited to 'src/lib/libcrypto/man')
0 files changed, 0 insertions, 0 deletions