summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonrad Borowski <konrad.borowski@kontomatik.com>2022-01-27 08:14:53 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2022-05-16 16:57:38 +0000
commit6a894d3e73ceeefb798364154072ebb5b7a2a1dc (patch)
treed96930afa12158c32fbf3c551d3ce25a0119c31c
parentnixos/wrappers: create a new assert macro that always asserts (diff)
downloadnixpkgs-origin/backport-156822-to-release-21.11.tar.gz
nixos/wrappers: require argc to be at least oneorigin/backport-156822-to-release-21.11
setuid applications were exploited in the past with an empty argv, such as pkexec using CVE-2021-4034. (cherry picked from commit 2a6a3d2c47626782f604a1fb4ec506c834efb47a)
-rw-r--r--nixos/modules/security/wrappers/wrapper.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/nixos/modules/security/wrappers/wrapper.c b/nixos/modules/security/wrappers/wrapper.c
index 49fc6c0ad532..a21ec500208d 100644
--- a/nixos/modules/security/wrappers/wrapper.c
+++ b/nixos/modules/security/wrappers/wrapper.c
@@ -170,6 +170,7 @@ int readlink_malloc(const char *p, char **ret) {
}
int main(int argc, char **argv) {
+ ASSERT(argc >= 1);
char *self_path = NULL;
int self_path_size = readlink_malloc("/proc/self/exe", &self_path);
if (self_path_size < 0) {