Skip to content

Commit 22c8df7

Browse files
committed
www/mod_tls: Fix build on i386
Obtained from: icing/mod_tls#7
1 parent 36bbbbc commit 22c8df7

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

www/mod_tls/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PORTNAME= mod_tls
22
PORTVERSION= 0.14.0
3+
PORTREVISION= 1
34
CATEGORIES= www security
45
MASTER_SITES= https://github.com/icing/mod_tls/releases/download/v${DISTVERSION}/
56
PKGNAMEPREFIX= ${APACHE_PKGNAMEPREFIX}
@@ -11,7 +12,7 @@ WWW= https://github.com/icing/mod_tls
1112
LICENSE= APACHE20
1213
LICENSE_FILE= ${WRKSRC}/LICENSE
1314

14-
BUILD_DEPENDS= rustls-ffi==0.14.0:security/rustls-ffi
15+
BUILD_DEPENDS= rustls-ffi>0.14.0:security/rustls-ffi
1516
LIB_DEPENDS= librustls.so:security/rustls-ffi
1617

1718
INSTALL_TARGET= install-strip
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From 0f869da21f79bd15435418f32fa51f3f7ca86743 Mon Sep 17 00:00:00 2001
2+
From: Daniel McCarney <daniel@binaryparadox.net>
3+
Date: Thu, 6 Feb 2025 10:59:39 -0500
4+
Subject: [PATCH] tls_cache: fix implicit conversion err on i386/i686
5+
6+
Previously on arch's where `apr_ssize_t` is an `int` (e.g. i386) the
7+
`tls_cache_get()` function produced an implicit conversion error of the
8+
form:
9+
10+
```
11+
error: implicit conversion changes signedness: 'unsigned int' to 'apr_ssize_t' (aka 'int')
12+
```
13+
14+
This commit resolves this error by:
15+
16+
1. Checking the two casts performed by this function are within the
17+
range of the types being cast to.
18+
2. Making the cast to `apr_ssize_t` explicit.
19+
---
20+
src/tls_cache.c | 6 +++++-
21+
1 file changed, 5 insertions(+), 1 deletion(-)
22+
23+
diff --git a/src/tls_cache.c b/src/tls_cache.c
24+
index 5fc874f..428a59e 100644
25+
--- src/tls_cache.c.orig
26+
+++ src/tls_cache.c
27+
@@ -231,6 +231,10 @@ static rustls_result tls_cache_get(
28+
unsigned int vlen, klen;
29+
const unsigned char *kdata;
30+
31+
+ if (key->len > UINT_MAX || key->len > SSIZE_MAX) {
32+
+ return RUSTLS_RESULT_INVALID_PARAMETER;
33+
+ }
34+
+
35+
if (!sc->global->session_cache) goto not_found;
36+
tls_cache_lock(sc->global);
37+
38+
@@ -241,7 +245,7 @@ static rustls_result tls_cache_get(
39+
sc->global->session_cache, cc->server, kdata, klen, buf, &vlen, c->pool);
40+
41+
if (APLOGctrace4(c)) {
42+
- apr_ssize_t n = klen;
43+
+ apr_ssize_t n = (apr_ssize_t) klen;
44+
ap_log_cerror(APLOG_MARK, APLOG_TRACE4, rv, c, "retrieve key %d[%8x], found %d val",
45+
klen, apr_hashfunc_default((const char*)kdata, &n), vlen);
46+
}

0 commit comments

Comments
 (0)