Source-Changes-HG archive

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

[src/netbsd-1-6]: src/usr.sbin/sushi Pull up revision 1.24 (requested by jaro...



details:   https://anonhg.NetBSD.org/src/rev/490fd57aa609
branches:  netbsd-1-6
changeset: 528627:490fd57aa609
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Jul 29 14:53:28 2002 +0000

description:
Pull up revision 1.24 (requested by jaromir in ticket #561):
fgetln() does NOT return NUL-terminated string
This fixes bin/13624 by Jun-ichiro itojun Hagino

diffstat:

 usr.sbin/sushi/scanform.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 1a23219ff54e -r 490fd57aa609 usr.sbin/sushi/scanform.c
--- a/usr.sbin/sushi/scanform.c Mon Jul 29 14:52:08 2002 +0000
+++ b/usr.sbin/sushi/scanform.c Mon Jul 29 14:53:28 2002 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: scanform.c,v 1.21.2.3 2002/07/29 14:52:08 lukem Exp $       */
+/*      $NetBSD: scanform.c,v 1.21.2.4 2002/07/29 14:53:28 lukem Exp $       */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -1224,8 +1224,8 @@
 
        p = fgetln(file, &len);
        if (p != NULL) {
+               p[len - 1] = '\0';      /* strip newline & NUL terminate */
                q = strdup(p);
-               q[len -1] = '\0';
        } else
                bailout("fgetln: %s", strerror(errno));
 
@@ -1335,8 +1335,8 @@
 
        p = fgetln(file, &len);
        if (p != NULL) {
+               p[len - 1] = '\0';      /* strip newline & NUL terminate */
                q = strdup(p);
-               q[len -1] = '\0';
        } else
                bailout("fgetln: %s", strerror(errno));
 



Home | Main Index | Thread Index | Old Index