Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic avoid undefined behavior
details: https://anonhg.NetBSD.org/src/rev/0e5633c328bf
branches: trunk
changeset: 787688:0e5633c328bf
user: christos <christos%NetBSD.org@localhost>
date: Fri Jun 28 14:48:17 2013 +0000
description:
avoid undefined behavior
http://m00nbsd.net/ae123a9bae03f7dde5c6d654412daf5a.html
diffstat:
sys/dev/ic/opl.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diffs (30 lines):
diff -r 6841d1f997f2 -r 0e5633c328bf sys/dev/ic/opl.c
--- a/sys/dev/ic/opl.c Fri Jun 28 14:46:44 2013 +0000
+++ b/sys/dev/ic/opl.c Fri Jun 28 14:48:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opl.c,v 1.39 2012/04/09 10:18:16 plunky Exp $ */
+/* $NetBSD: opl.c,v 1.40 2013/06/28 14:48:17 christos Exp $ */
/*
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.39 2012/04/09 10:18:16 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: opl.c,v 1.40 2013/06/28 14:48:17 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -158,8 +158,9 @@
mutex_exit(sc->lock);
sc->syn.mets = &opl3_midi;
- snprintf(sc->syn.name, sizeof(sc->syn.name), "%sYamaha OPL%d",
- sc->syn.name, sc->model);
+ size_t len = strlen(sc->syn.name);
+ snprintf(sc->syn.name + len, sizeof(sc->syn.name) - len, "Yamaha OPL%d",
+ sc->model);
sc->syn.data = sc;
sc->syn.nvoice = sc->model == OPL_2 ? OPL2_NVOICE : OPL3_NVOICE;
sc->syn.lock = sc->lock;
Home |
Main Index |
Thread Index |
Old Index