summaryrefslogtreecommitdiff
path: root/src/lib/libssl/ssl_lib.c
diff options
context:
space:
mode:
authortb <>2023-04-23 10:19:52 +0000
committertb <>2023-04-23 10:19:52 +0000
commita77795d252b58fa4bbaf3beec1fa1dac50f6785c (patch)
treed663d22d8bd9b3ed8b9d637b03163f8cbcffc10d /src/lib/libssl/ssl_lib.c
parent096877f0408128467e9955e510bce04c2d583bf4 (diff)
downloadopenbsd-a77795d252b58fa4bbaf3beec1fa1dac50f6785c.tar.gz
openbsd-a77795d252b58fa4bbaf3beec1fa1dac50f6785c.tar.bz2
openbsd-a77795d252b58fa4bbaf3beec1fa1dac50f6785c.zip
Align hex_to_string with OpenSSL 1.1 behavior
This is a bit of a strange one. When this function was moved and renamed, somehow checks for NULL pointers and 0 length were lost. Whether that was due to great review missing it or great review suggesting it, is unclear. Now the function can actually legitimately be called with a length of 0 (as ASN.1 OCTET STRINGS can have length 0) and "" is the appropriate representation for that, so the fix is to allocate a 0 octet. That much was correct. What was completely missed is that a long can be negative which will then still lead to an out-of-bounds access. So fix that as well. Finally, don't malloc 3 * len + 1 without overflow checking. Rather use calloc's internal checks. The + 1 isn't really needed anyway. All this is still really gross and can be done much more cleanly and safely with CBB/CBS. This will done later once we have better regress coverage. ok jsing
Diffstat (limited to 'src/lib/libssl/ssl_lib.c')
0 files changed, 0 insertions, 0 deletions