Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libossaudio memset to zero the entire array, not just 8 ...



details:   https://anonhg.NetBSD.org/src/rev/b054dce32cb8
branches:  trunk
changeset: 448153:b054dce32cb8
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Jan 23 00:08:06 2019 +0000

description:
memset to zero the entire array, not just 8 bytes of it.

picked up by gcc7's checker that the array size has not
been multipled by the member size.

here, we had 8 but should have had 8 * sizeof(int).

XXX: real bug - pullup-7, pullup-8

diffstat:

 lib/libossaudio/ossaudio.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r e3a387e4579d -r b054dce32cb8 lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c        Wed Jan 23 00:05:47 2019 +0000
+++ b/lib/libossaudio/ossaudio.c        Wed Jan 23 00:08:06 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.33 2017/03/23 15:50:48 nat Exp $        */
+/*     $NetBSD: ossaudio.c,v 1.34 2019/01/23 00:08:06 mrg Exp $        */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.33 2017/03/23 15:50:48 nat Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.34 2019/01/23 00:08:06 mrg Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -503,13 +503,13 @@
                memset(tmpsysinfo.options, 0, 8);
                tmpsysinfo.numaudios = OSS_MAX_AUDIO_DEVS;
                tmpsysinfo.numaudioengines = 1;
-               memset(tmpsysinfo.openedaudio, 0, 8);
+               memset(tmpsysinfo.openedaudio, 0, sizeof(tmpsysinfo.openedaudio));
                tmpsysinfo.numsynths = 1;
                tmpsysinfo.nummidis = -1;
                tmpsysinfo.numtimers = -1;
                tmpsysinfo.nummixers = 1;
                tmpsysinfo.numcards = 1;
-               memset(tmpsysinfo.openedmidi, 0, 8);
+               memset(tmpsysinfo.openedmidi, 0, sizeof(tmpsysinfo.openedmidi));
                *(struct oss_sysinfo *)argp = tmpsysinfo;
                break;
        case SNDCTL_ENGINEINFO:



Home | Main Index | Thread Index | Old Index