From fa8c57777ca97b94c2cf9b17fcb6941668255320 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 13 Nov 2024 21:47:41 -0500 Subject: kernel: sysctl: Fix handling of oldlenp Signed-off-by: Ian Moffett --- sys/kern/kern_sysctl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/kern') diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 6334d06..ae724b7 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -231,7 +231,11 @@ sysctl(struct sysctl_args *args) memcpy(args->oldp, &tmp_int, oldlen); } - return (len > oldlen) ? -ENOMEM : 0; + if (args->oldlenp != NULL && len > oldlen) { + return -ENOMEM; + } + + return 0; } scret_t -- cgit v1.2.3