diff options
| author | roy <roy@NetBSD.org> | 2020-05-30 16:03:58 +0000 |
|---|---|---|
| committer | roy <roy@NetBSD.org> | 2020-05-30 16:03:58 +0000 |
| commit | 3efb49c2f22c781a05365a1c2cde1cb4c12e20a5 (patch) | |
| tree | 2a2cb972ef5195254f19ad9ae4ef8ee2dae4c216 /lib/libterminfo | |
| parent | bdf4b599f32936da2da5843cb15edd1305346f9f (diff) | |
terminfo: test strlcpy result against space free, not string length
riastradh@ yep, looks good.
Diffstat (limited to 'lib/libterminfo')
| -rw-r--r-- | lib/libterminfo/curterm.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libterminfo/curterm.c b/lib/libterminfo/curterm.c index 3b8a708898d..21236d7b693 100644 --- a/lib/libterminfo/curterm.c +++ b/lib/libterminfo/curterm.c @@ -1,4 +1,4 @@ -/* $NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $ */ +/* $NetBSD: curterm.c,v 1.14 2020/05/30 16:03:58 roy 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.14 2020/05/30 16:03:58 roy Exp $"); #include <assert.h> #include <stdlib.h> @@ -99,21 +99,21 @@ set_curterm(TERMINAL *nterm) 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; |
