torsocks: fix tagged pointer aborts/segfaults on some Android 11 devices. (#8187)

This commit is contained in:
Ladar Levison 2021-12-09 03:06:30 -06:00 committed by GitHub
parent 48f65b6aa1
commit c53780c5bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,27 @@
diff --git a/src/common/onion.c b/src/common/onion.c
index 6a61d83..05d21fc 100644
--- a/src/common/onion.c
+++ b/src/common/onion.c
@@ -151,7 +151,7 @@ void onion_pool_destroy(struct onion_pool *pool)
onion_entry_destroy(pool->entries[i]);
}
- free(pool->entries);
+ free(*(struct onion_entry **)pool->entries);
}
/*
diff --git a/src/lib/torsocks.c b/src/lib/torsocks.c
index 16f2da0..2b991c7 100644
--- a/src/lib/torsocks.c
+++ b/src/lib/torsocks.c
@@ -348,7 +348,8 @@ static void tsocks_exit(void)
/* Cleanup every entries in the onion pool. */
onion_pool_destroy(&tsocks_onion_pool);
/* Cleanup allocated memory in the config file. */
- config_file_destroy(&tsocks_config.conf_file);
+ /* This triggers a tagged pointer truncation error/sigabrt on Android 11. */
+ /* config_file_destroy(&tsocks_config.conf_file); */
/* Clean up logging. */
log_destroy();
}

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Wrapper to safely torify applications"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.3.0
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://github.com/dgoulet/torsocks/archive/v$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=817c143e8a9d217f41a223a85139c6ca28e1b99556c547fcdb4c72dbc170b6c9
TERMUX_PKG_DEPENDS="tor"