summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJessica Clarke <jrtc27@jrtc27.com>2021-12-21 13:15:58 +0000
committerJessica Clarke <jrtc27@jrtc27.com>2021-12-21 13:15:58 +0000
commita9595ccd7d1d6c02836d2facda0ba10bf4b66a79 (patch)
tree8e1455206e4f82a429a1d218b465deccb1cc7d2a /test
parent09e9fed2bd6b8123d5f1e886b0bd9a9c21cec0c9 (diff)
downloadlibevent-a9595ccd7d1d6c02836d2facda0ba10bf4b66a79.tar.gz
regress_ssl: Use intptr_t when shoving an int into a void *
Currently the code uses long, but long does not always have the same representation as a pointer, such as on 64-bit Windows where long is only 32-bit due to its unususal LLP64 ABI, but also on CHERI, and thus Arm's prototype Morello architecture, where C language pointers are represented as hardware capabilities, which have bounds, permissions and other metadata to enforce spatial memory safety. Both of these cases warn when casting a long to a pointer (Windows due to long being shorter and thus it being likely you've truncated the address, and CHERI due to long not having any capability metadata like pointers and thus it being likely you've stripped the metadata, with the resulting "null-derived" capability destined to trap if dereferenced), and in both cases casting to intptr_t as the intermediate type instead will get rid of those warnings.
Diffstat (limited to 'test')
-rw-r--r--test/regress_ssl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/regress_ssl.c b/test/regress_ssl.c
index 447a4c34..c53d249d 100644
--- a/test/regress_ssl.c
+++ b/test/regress_ssl.c
@@ -295,9 +295,9 @@ open_ssl_bufevs(struct bufferevent **bev1_out, struct bufferevent **bev2_out,
}
bufferevent_setcb(*bev1_out, respond_to_number, done_writing_cb,
- eventcb, (void*)(REGRESS_OPENSSL_CLIENT | (long)type));
+ eventcb, (void*)(REGRESS_OPENSSL_CLIENT | (intptr_t)type));
bufferevent_setcb(*bev2_out, respond_to_number, done_writing_cb,
- eventcb, (void*)(REGRESS_OPENSSL_SERVER | (long)type));
+ eventcb, (void*)(REGRESS_OPENSSL_SERVER | (intptr_t)type));
bufferevent_ssl_set_allow_dirty_shutdown(*bev1_out, dirty_shutdown);
bufferevent_ssl_set_allow_dirty_shutdown(*bev2_out, dirty_shutdown);