summaryrefslogtreecommitdiff
path: root/lib/libterminfo
diff options
context:
space:
mode:
authorroy <roy@NetBSD.org>2020-03-12 14:52:04 +0000
committerroy <roy@NetBSD.org>2020-03-12 14:52:04 +0000
commit644eaaceb5fb65557ff990d7eb2ca68191c27efb (patch)
treecb434a4dab8ecb60f051350859b37227ec099b96 /lib/libterminfo
parentc8e90a79d612f3229a91385635112e34c7ee75fe (diff)
terminfo: truncate numeric parameters to a short
Because that is what our API demands. We should probably change to int when we next bump the API.
Diffstat (limited to 'lib/libterminfo')
-rw-r--r--lib/libterminfo/compile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libterminfo/compile.c b/lib/libterminfo/compile.c
index 6c65c35d325..982d979a952 100644
--- a/lib/libterminfo/compile.c
+++ b/lib/libterminfo/compile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: compile.c,v 1.12 2017/05/04 09:46:30 roy Exp $ */
+/* $NetBSD: compile.c,v 1.13 2020/03/12 14:52:04 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: compile.c,v 1.12 2017/05/04 09:46:30 roy Exp $");
+__RCSID("$NetBSD: compile.c,v 1.13 2020/03/12 14:52:04 roy Exp $");
#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H
#include <sys/endian.h>
@@ -579,7 +579,11 @@ _ti_compile(char *cap, int flags)
tic->name, token);
continue;
}
- num = (short)cnum;
+
+ if (cnum > SHRT_MAX)
+ num = SHRT_MAX;
+ else
+ num = (short)cnum;
if (ind == -1)
_ti_store_extra(tic, 1, token, 'n', -1,
num, NULL, 0, flags);