diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-03-28 15:08:36 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-03-28 15:08:36 +0000 |
commit | 3428b6c050d102ba7f95514b29f4f5685d76b645 (patch) | |
tree | 410bcecaebc37e5c1de220bdc0589391e0a27c53 /sys/dev/sound/pcm/dsp.c | |
parent | 1c1ff7979571bf07c05a48e857b7b285b037410f (diff) | |
download | src-3428b6c050d102ba7f95514b29f4f5685d76b645.tar.gz src-3428b6c050d102ba7f95514b29f4f5685d76b645.zip |
Fix several dev_clone callbacks to avoid out-of-bounds reads
Use strncmp() instead of bcmp(), so that we don't have to find the
minimum of the string lengths before comparing.
Reviewed by: kib
Reported by: KASAN
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29463
Diffstat (limited to 'sys/dev/sound/pcm/dsp.c')
-rw-r--r-- | sys/dev/sound/pcm/dsp.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 0593a585b0fd..cce05f4ecf37 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2294,8 +2294,7 @@ dsp_stdclone(char *name, char *namep, char *sep, int use_sep, int *u, int *c) size_t len; len = strlen(namep); - - if (bcmp(name, namep, len) != 0) + if (strncmp(name, namep, len) != 0) return (ENODEV); name += len; |