diff options
author | Christos Margiolis <christos@FreeBSD.org> | 2024-07-06 18:23:15 +0000 |
---|---|---|
committer | Christos Margiolis <christos@FreeBSD.org> | 2024-07-06 18:23:15 +0000 |
commit | 1a768ea9db3d66941b0dc5340ac028ef548808b8 (patch) | |
tree | 685480104992c4620123344ec0388b16ec76a3f3 /sys/dev/sound/pcm/dsp.c | |
parent | 9d8b93bc9ccea82b648ffa9354200c9e4d3f211b (diff) | |
download | src-1a768ea9db3d66941b0dc5340ac028ef548808b8.tar.gz src-1a768ea9db3d66941b0dc5340ac028ef548808b8.zip |
sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO
If the channel list is empty, min_rate and min_channels will be INT_MAX.
Instead, assign them to 0, like we do in sndstat_get_caps().
Sponsored by: The FreeBSD Foundation
MFC after: 2 days
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D45876
Diffstat (limited to 'sys/dev/sound/pcm/dsp.c')
-rw-r--r-- | sys/dev/sound/pcm/dsp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0689dfedb9c2..2b765bc8b115 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2182,6 +2182,10 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex) CHN_UNLOCK(ch); } + if (ai->min_rate == INT_MAX) + ai->min_rate = 0; + if (ai->min_channels == INT_MAX) + ai->min_channels = 0; PCM_UNLOCK(d); |