Source-Changes-HG archive

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

[src/netbsd-8]: src/lib/libterminfo Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/f6581d88a828
branches:  netbsd-8
changeset: 933918:f6581d88a828
user:      martin <martin%NetBSD.org@localhost>
date:      Sun May 31 10:43:05 2020 +0000

description:
Pull up following revision(s) (requested by roy in ticket #1552):

        lib/libterminfo/curterm.c: revision 1.14

terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.

diffstat:

 lib/libterminfo/curterm.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (45 lines):

diff -r d0a27d56d18d -r f6581d88a828 lib/libterminfo/curterm.c
--- a/lib/libterminfo/curterm.c Sun May 31 10:27:26 2020 +0000
+++ b/lib/libterminfo/curterm.c Sun May 31 10:43:05 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.13.2.1 2020/05/31 10:43:05 martin Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.13.2.1 2020/05/31 10:43:05 martin Exp $");
 
 #include <assert.h>
 #include <stdlib.h>
@@ -99,21 +99,21 @@
 
                p = ttytype;
                l = sizeof(ttytype);
-               if ((n = strlcpy(p, nterm->name, l)) == strlen(p)) {
+               if ((n = strlcpy(p, nterm->name, l)) < l) {
                        p += n;
                        l -= n;
                        *p++ = '|';
                        l--;
-                       if (nterm->_alias  &&
-                               (n = strlcpy(p, nterm->_alias, l)) == strlen(p))
+                       if (nterm->_alias != NULL &&
+                           (n = strlcpy(p, nterm->_alias, l)) < l)
                        {
                                p += n;
                                l -= n;
                                *p++ = '|';
                                l--;
                        }
-                       if (nterm->desc  &&
-                               (n = strlcpy(p, nterm->desc, l)) == strlen(p))
+                       if (nterm->desc != NULL &&
+                           (n = strlcpy(p, nterm->desc, l)) < l)
                        {
                                p += n;
                                l -= n;



Home | Main Index | Thread Index | Old Index