Skip to content

Commit

Permalink
Fix asan finding in bio_addr
Browse files Browse the repository at this point in the history
Running test_tfo_cli under asan yields
==166214==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60700000d57c at pc 0x03ffa004ed86 bp 0x03ffe2977e80 sp 0x03ffe2977668
READ of size 112 at 0x60700000d57c thread T0
    #0 0x3ffa004ed85 in memcpy (/lib64/libasan.so.8+0x4ed85)
    #1 0x3ff9f3615b7 in BIO_ADDR_dup crypto/bio/bio_addr.c:77
[...]
and fails the test.

Fix this by copying the right structure of the union.

Signed-off-by: Juergen Christ <jchrist@linux.ibm.com>

Reviewed-by: Todd Short <todd.short@me.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from #18979)
  • Loading branch information
juergenchrist authored and mattcaswell committed Aug 12, 2022
1 parent d13c8b7 commit 278b0d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/bio/bio_addr.c
Expand Up @@ -74,7 +74,7 @@ BIO_ADDR *BIO_ADDR_dup(const BIO_ADDR *ap)
if (ap != NULL) {
ret = BIO_ADDR_new();
if (ret != NULL)
memcpy(ret, ap, sizeof(BIO_ADDR));
BIO_ADDR_make(ret, &ap->sa);
}
return ret;
}
Expand Down

0 comments on commit 278b0d8

Please sign in to comment.