Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbarm/marvell Fix to assert. We call to strncpy()...



details:   https://anonhg.NetBSD.org/src/rev/a2b25673d5dc
branches:  trunk
changeset: 780673:a2b25673d5dc
user:      kiyohara <kiyohara%NetBSD.org@localhost>
date:      Fri Aug 03 07:56:37 2012 +0000

description:
Fix to assert.  We call to strncpy(), if r3 of args is valid from u-boot.

diffstat:

 sys/arch/evbarm/marvell/marvell_machdep.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 8cc179e15bd9 -r a2b25673d5dc sys/arch/evbarm/marvell/marvell_machdep.c
--- a/sys/arch/evbarm/marvell/marvell_machdep.c Fri Aug 03 07:54:14 2012 +0000
+++ b/sys/arch/evbarm/marvell/marvell_machdep.c Fri Aug 03 07:56:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: marvell_machdep.c,v 1.11 2012/07/29 00:07:09 matt Exp $ */
+/*     $NetBSD: marvell_machdep.c,v 1.12 2012/08/03 07:56:37 kiyohara Exp $ */
 /*
  * Copyright (c) 2007, 2008, 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: marvell_machdep.c,v 1.11 2012/07/29 00:07:09 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: marvell_machdep.c,v 1.12 2012/08/03 07:56:37 kiyohara Exp $");
 
 #include "opt_evbarm_boardtype.h"
 #include "opt_ddb.h"
@@ -422,8 +422,9 @@
 #define _BDSTR(s)      #s
        printf("\nNetBSD/evbarm (" BDSTR(EVBARM_BOARDTYPE) ") booting ...\n");
 
-       /* copy command line U-Boot gave us */
-       strncpy(bootargs, (char *)u_boot_args[3], sizeof(bootargs));
+       /* copy command line U-Boot gave us, if args is valid. */
+       if (u_boot_args[3] != 0)        /* XXXXX: need more check?? */
+               strncpy(bootargs, (char *)u_boot_args[3], sizeof(bootargs));
 
 #ifdef VERBOSE_INIT_ARM
        printf("initarm: Configuring system ...\n");



Home | Main Index | Thread Index | Old Index