From eb952c651feed0502ec0d7ecaefc4931968eb358 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Wed, 16 Oct 2019 00:42:21 +0000 Subject: [PATCH] ncurses 6.1 - patch 20191015 + improve buffer-checks in captoinfo.c, for some cases when the input string is shorter than expected. > fix two errata in tic (report/testcases by Hongxu Chen): + check for missing character after backslash in write_it + check for missing characters after "%>" when converting from termcap syntax (cf: 980530). --- NEWS | 10 +++++++++- VERSION | 2 +- dist.mk | 4 ++-- ncurses/tinfo/captoinfo.c | 34 +++++++++++++++++++------------- package/debian-mingw/changelog | 4 ++-- package/debian-mingw64/changelog | 4 ++-- package/debian/changelog | 4 ++-- package/mingw-ncurses.nsi | 4 ++-- package/mingw-ncurses.spec | 2 +- package/ncurses.spec | 2 +- package/ncursest.spec | 2 +- progs/tic.c | 5 +++-- 12 files changed, 46 insertions(+), 31 deletions(-) diff --git a/NEWS b/NEWS index 5ba46e9b..509ff3fe 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3389 2019/10/12 21:17:50 tom Exp $ +-- $Id: NEWS,v 1.3393 2019/10/16 00:04:31 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -45,6 +45,14 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20191015 + + improve buffer-checks in captoinfo.c, for some cases when the + input string is shorter than expected. + > fix two errata in tic (report/testcases by Hongxu Chen): + + check for missing character after backslash in write_it + + check for missing characters after "%>" when converting from termcap + syntax (cf: 980530). + 20191012 + amend recent changes to ncurses*-config and pc-files to filter out Debian linker-flags (report by Sven Joachim, cf: 20150516). diff --git a/VERSION b/VERSION index b8433300..0e4e4761 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -5:0:10 6.1 20191012 +5:0:10 6.1 20191015 diff --git a/dist.mk b/dist.mk index 8832349b..66ba0ddf 100644 --- a/dist.mk +++ b/dist.mk @@ -25,7 +25,7 @@ # use or other dealings in this Software without prior written # # authorization. # ############################################################################## -# $Id: dist.mk,v 1.1309 2019/10/12 15:30:55 tom Exp $ +# $Id: dist.mk,v 1.1310 2019/10/15 21:46:57 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -37,7 +37,7 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 6 NCURSES_MINOR = 1 -NCURSES_PATCH = 20191012 +NCURSES_PATCH = 20191015 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c index 6a2252ee..a9eb1e53 100644 --- a/ncurses/tinfo/captoinfo.c +++ b/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc. * + * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -97,7 +97,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.96 2018/05/12 16:46:55 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.97 2019/10/15 23:13:35 tom Exp $") #if 0 #define DEBUG_THIS(p) DEBUG(9, p) @@ -210,7 +210,7 @@ cvtchar(register const char *sp) break; default: c = UChar(*sp); - len = 2; + len = (c != '\0') ? 2 : 1; break; } break; @@ -224,13 +224,13 @@ cvtchar(register const char *sp) break; default: c = UChar(*sp); - len = 1; + len = (c != '\0') ? 1 : 0; } if (isgraph(c) && c != ',' && c != '\'' && c != '\\' && c != ':') { dp = save_string(dp, "%\'"); dp = save_char(dp, c); dp = save_char(dp, '\''); - } else { + } else if (c != '\0') { dp = save_string(dp, "%{"); if (c > 99) dp = save_char(dp, c / 100 + '0'); @@ -313,7 +313,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized) if (s == 0) s = ""; if (parameterized >= 0 && isdigit(UChar(*s))) - for (capstart = s;; s++) + for (capstart = s; *s != '\0'; s++) if (!(isdigit(UChar(*s)) || *s == '*' || *s == '.')) break; @@ -360,13 +360,18 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized) dp = save_string(dp, "%{2}%*%-"); break; case '>': - getparm(param, 2); /* %?%{x}%>%t%{y}%+%; */ - dp = save_string(dp, "%?"); - s += cvtchar(s); - dp = save_string(dp, "%>%t"); - s += cvtchar(s); - dp = save_string(dp, "%+%;"); + if (s[0] && s[1]) { + getparm(param, 2); + dp = save_string(dp, "%?"); + s += cvtchar(s); + dp = save_string(dp, "%>%t"); + s += cvtchar(s); + dp = save_string(dp, "%+%;"); + } else { + _nc_warning("expected two characters after %%>"); + dp = save_string(dp, "%>"); + } break; case 'a': if ((*s == '=' || *s == '+' || *s == '-' @@ -492,7 +497,8 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized) } break; default: - dp = save_char(dp, *s++); + if (*s != '\0') + dp = save_char(dp, *s++); break; } } @@ -503,7 +509,7 @@ _nc_captoinfo(const char *cap, const char *s, int const parameterized) */ if (capstart) { dp = save_string(dp, "$<"); - for (s = capstart;; s++) + for (s = capstart; *s != '\0'; s++) if (isdigit(UChar(*s)) || *s == '*' || *s == '.') dp = save_char(dp, *s); else diff --git a/package/debian-mingw/changelog b/package/debian-mingw/changelog index b0454cb4..65032439 100644 --- a/package/debian-mingw/changelog +++ b/package/debian-mingw/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20191012) unstable; urgency=low +ncurses6 (6.1+20191015) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 11 Oct 2019 19:37:45 -0400 + -- Thomas E. Dickey Tue, 15 Oct 2019 17:46:57 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian-mingw64/changelog b/package/debian-mingw64/changelog index b0454cb4..65032439 100644 --- a/package/debian-mingw64/changelog +++ b/package/debian-mingw64/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20191012) unstable; urgency=low +ncurses6 (6.1+20191015) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 11 Oct 2019 19:37:45 -0400 + -- Thomas E. Dickey Tue, 15 Oct 2019 17:46:57 -0400 ncurses6 (5.9-20131005) unstable; urgency=low diff --git a/package/debian/changelog b/package/debian/changelog index e739b5dd..08605a4f 100644 --- a/package/debian/changelog +++ b/package/debian/changelog @@ -1,8 +1,8 @@ -ncurses6 (6.1+20191012) unstable; urgency=low +ncurses6 (6.1+20191015) unstable; urgency=low * latest weekly patch - -- Thomas E. Dickey Fri, 11 Oct 2019 19:37:45 -0400 + -- Thomas E. Dickey Tue, 15 Oct 2019 17:46:57 -0400 ncurses6 (5.9-20120608) unstable; urgency=low diff --git a/package/mingw-ncurses.nsi b/package/mingw-ncurses.nsi index 10a27990..d91112de 100644 --- a/package/mingw-ncurses.nsi +++ b/package/mingw-ncurses.nsi @@ -1,4 +1,4 @@ -; $Id: mingw-ncurses.nsi,v 1.355 2019/10/12 15:30:55 tom Exp $ +; $Id: mingw-ncurses.nsi,v 1.356 2019/10/15 21:46:57 tom Exp $ ; TODO add examples ; TODO bump ABI to 6 @@ -10,7 +10,7 @@ !define VERSION_MAJOR "6" !define VERSION_MINOR "1" !define VERSION_YYYY "2019" -!define VERSION_MMDD "1012" +!define VERSION_MMDD "1015" !define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD} !define MY_ABI "5" diff --git a/package/mingw-ncurses.spec b/package/mingw-ncurses.spec index 41bd788f..8f10c475 100644 --- a/package/mingw-ncurses.spec +++ b/package/mingw-ncurses.spec @@ -3,7 +3,7 @@ Summary: shared libraries for terminal handling Name: mingw32-ncurses6 Version: 6.1 -Release: 20191012 +Release: 20191015 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncurses.spec b/package/ncurses.spec index 478c6656..84b734ce 100644 --- a/package/ncurses.spec +++ b/package/ncurses.spec @@ -1,7 +1,7 @@ Summary: shared libraries for terminal handling Name: ncurses6 Version: 6.1 -Release: 20191012 +Release: 20191015 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/package/ncursest.spec b/package/ncursest.spec index 1ada75f5..94556487 100644 --- a/package/ncursest.spec +++ b/package/ncursest.spec @@ -1,7 +1,7 @@ Summary: Curses library with POSIX thread support. Name: ncursest6 Version: 6.1 -Release: 20191012 +Release: 20191015 License: X11 Group: Development/Libraries Source: ncurses-%{version}-%{release}.tgz diff --git a/progs/tic.c b/progs/tic.c index 2f3b5877..b8a12d25 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.278 2019/07/27 22:44:21 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.279 2019/10/15 22:18:29 tom Exp $") #define STDIN_NAME "" @@ -218,7 +218,8 @@ write_it(ENTRY * ep) while ((ch = *t++) != 0) { *d++ = (char) ch; if (ch == '\\') { - *d++ = *t++; + if ((*d++ = *t++) == '\0') + break; } else if ((ch == '%') && (*t == L_BRACE)) { char *v = 0; -- 2.44.0