[dev] [slstatus] [patch] volume component segfaults on sndio server.device change (OpenBSD)

From: Chris Billington <emulti_AT_disroot.org>
Date: Fri, 21 Nov 2025 13:03:04 +0800

On OpenBSD 7.8 (which uses sndiod) the audio volume component of
slstatus reliably segfaults when the sndio server is switched at
runtime, for example with 'sndioctl server.device=1' when the current
device is server.device-0.

The following minimal patch adds a check to prevent a NULL pointer
dereference and avoid the segfault.

Tested locally on OpenBSD 7.8/amd64, resolves the issue.
                                                                          
From 0a3a51ff2663c70fe2e1cc5a1b13fd75ad2e48ba Mon Sep 17 00:00:00 2001

From: Chris Billington <emulti_AT_disroot.org>
Date: Fri, 21 Nov 2025 12:31:40 +0800
Subject: [PATCH] volume: avoid NULL dereference in onval() on sndio
device switch

---
 components/volume.c | 2 ++
 1 file changed, 2 insertions(+) 
diff --git a/components/volume.c b/components/volume.c
index 6cec556..23ddfc5 100644 
--- a/components/volume.c 
+++ b/components/volume.c 
_AT_@ -89,6 +89,8 @@
	 if (c->addr == addr)
	    break;
        } 
+       if(c == NULL)                                        
+           return;
        c->val = val;
    } 
-- 
2.51.0            
Patch is also attached because pasting it inline here messes up the
formatting somewhat.
--
Chris Billington
Received on Fri Nov 21 2025 - 06:03:04 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 21 2025 - 06:12:09 CET