Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/vi/common improve on previous. only adjust the lengt...



details:   https://anonhg.NetBSD.org/src/rev/cc96251e003c
branches:  trunk
changeset: 545988:cc96251e003c
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Apr 18 18:46:26 2003 +0000

description:
improve on previous. only adjust the length when it exceed the string length.

diffstat:

 usr.bin/vi/common/line.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 1a0e66fef67e -r cc96251e003c usr.bin/vi/common/line.c
--- a/usr.bin/vi/common/line.c  Fri Apr 18 18:33:41 2003 +0000
+++ b/usr.bin/vi/common/line.c  Fri Apr 18 18:46:26 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: line.c,v 1.5 2003/04/18 18:33:41 christos Exp $        */
+/*     $NetBSD: line.c,v 1.6 2003/04/18 18:46:26 christos Exp $        */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -16,7 +16,7 @@
 #if 0
 static const char sccsid[] = "@(#)line.c       10.21 (Berkeley) 9/15/96";
 #else
-__RCSID("$NetBSD: line.c,v 1.5 2003/04/18 18:33:41 christos Exp $");
+__RCSID("$NetBSD: line.c,v 1.6 2003/04/18 18:46:26 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -186,7 +186,9 @@
                        /*
                         * This breaks recovery of binary files
                         */
-                       data.size = strlen((const char *)data.data);
+                       size_t olen = strlen((const char *)data.data);
+                       if (olen < data.size)
+                               data.size = olen;
                }
        }
 



Home | Main Index | Thread Index | Old Index