Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/arch/sparc/dev Pull up revision 1.70 (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/de5bc6546254
branches:  netbsd-1-4
changeset: 470031:de5bc6546254
user:      he <he%NetBSD.org@localhost>
date:      Sat Jan 15 16:50:53 2000 +0000

description:
Pull up revision 1.70 (requested by pk):
  Two fixes:
   o Fix out of bound indexing of buffer.
   o Default to first serial port if console property is absent.

diffstat:

 sys/arch/sparc/dev/zs.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 450412e8a080 -r de5bc6546254 sys/arch/sparc/dev/zs.c
--- a/sys/arch/sparc/dev/zs.c   Sat Jan 15 16:48:22 2000 +0000
+++ b/sys/arch/sparc/dev/zs.c   Sat Jan 15 16:50:53 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs.c,v 1.69 1999/03/27 01:21:36 wrstuden Exp $ */
+/*     $NetBSD: zs.c,v 1.69.2.1 2000/01/15 16:50:53 he Exp $   */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -906,9 +906,19 @@
         * At this point we assume the device path is in the form
         *   ....device@x,y:a for ttya and ...device@x,y:b for ttyb, etc.
         */
-       while (*cp != 0)
-               cp++;
-       cp -= 2;
+       if (cp[0] != '\0' && cp[1] != '\0') {
+               while (*cp != '\0')
+                       cp++;
+               cp -= 2;
+       } else {
+               /*
+                * If don't have at least a 2 character string at cp, then
+                *  we default to using using the string ":a" for ttya.
+                */
+               cp[0] = ':';
+               cp[1] = 'a';
+               cp[2] = '\0';
+       }
 
        if (cp >= buffer) {
                /* XXX: only allows tty's a->z, assumes PROMDEV_TTYx contig */



Home | Main Index | Thread Index | Old Index