Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/ossaudio ossaudio: Avoid giving userland uninitia...



details:   https://anonhg.NetBSD.org/src/rev/af3a7a95feb9
branches:  trunk
changeset: 931009:af3a7a95feb9
user:      nia <nia%NetBSD.org@localhost>
date:      Sun Apr 19 21:37:00 2020 +0000

description:
ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.

diffstat:

 sys/compat/ossaudio/ossaudio.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r edd98083f340 -r af3a7a95feb9 sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c    Sun Apr 19 21:24:36 2020 +0000
+++ b/sys/compat/ossaudio/ossaudio.c    Sun Apr 19 21:37:00 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $        */
+/*     $NetBSD: ossaudio.c,v 1.83 2020/04/19 21:37:00 nia Exp $        */
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.83 2020/04/19 21:37:00 nia Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1103,6 +1103,7 @@
                            __func__, error));
                        goto out;
                }
+               memset(&omi, 0, sizeof omi);
                omi.modify_counter = 1;
                strncpy(omi.id, adev.name, sizeof omi.id);
                strncpy(omi.name, adev.name, sizeof omi.name);



Home | Main Index | Thread Index | Old Index