ncurses 5.7 - patch 20091205

+ correct layout of working window used to extract data in
  wide-character configured by set_field_buffer (patch by Rafael
  Garrido Fernandez)
+ improve some limit-checks related to filename length in reading and
  writing terminfo entries.
+ ensure that filename is always filled in when attempting to read
  a terminfo entry, so that infocmp can report the filename (patch
  by Nicholas Marriott).
This commit is contained in:
Thomas E. Dickey 2009-12-06 01:32:45 +00:00
parent 49e6baa949
commit cb9a015f66
7 changed files with 53 additions and 35 deletions

12
NEWS
View File

@ -25,7 +25,7 @@
-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
-- $Id: NEWS,v 1.1468 2009/11/28 22:51:06 tom Exp $
-- $Id: NEWS,v 1.1470 2009/12/05 22:07:39 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
@ -45,6 +45,16 @@ 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.
20091205
+ correct layout of working window used to extract data in
wide-character configured by set_field_buffer (patch by Rafael
Garrido Fernandez)
+ improve some limit-checks related to filename length in reading and
writing terminfo entries.
+ ensure that filename is always filled in when attempting to read
a terminfo entry, so that infocmp can report the filename (patch
by Nicholas Marriott).
20091128
+ modify mk-1st.awk to allow tinfo library to be built when term-driver
is enabled.

View File

@ -25,7 +25,7 @@
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
# $Id: dist.mk,v 1.733 2009/11/28 17:54:26 tom Exp $
# $Id: dist.mk,v 1.734 2009/12/05 18:20:30 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 = 5
NCURSES_MINOR = 7
NCURSES_PATCH = 20091128
NCURSES_PATCH = 20091205
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)

View File

@ -32,7 +32,7 @@
#include "form.priv.h"
MODULE_ID("$Id: frm_driver.c,v 1.94 2009/11/07 19:54:03 tom Exp $")
MODULE_ID("$Id: frm_driver.c,v 1.95 2009/12/05 21:45:58 Rafael.Garrido.Fernandez Exp $")
/*----------------------------------------------------------------------------
This is the core module of the form library. It contains the majority
@ -4430,11 +4430,11 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
* and other special cases that we really do not want to handle here.
*/
#if NCURSES_EXT_FUNCS
if (wresize(field->working, field->drows, field->dcols) == ERR)
if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR)
#endif
{
delwin(field->working);
field->working = newpad(field->drows, field->dcols);
field->working = newpad(1, Buffer_Length(field) + 1);
}
len = Buffer_Length(field);
wclear(field->working);
@ -4448,7 +4448,7 @@ set_field_buffer(FIELD *field, int buffer, const char *value)
{
for (i = 0; i < (unsigned)field->drows; ++i)
{
mvwin_wchnstr(field->working, i, 0,
mvwin_wchnstr(field->working, 0, i * field->dcols,
widevalue + (i * field->dcols),
field->dcols);
}

View File

@ -35,7 +35,7 @@
/*
* $Id: curses.priv.h,v 1.444 2009/11/28 22:43:12 tom Exp $
* $Id: curses.priv.h,v 1.445 2009/12/05 21:20:51 tom Exp $
*
* curses.priv.h
*
@ -686,8 +686,10 @@ typedef struct {
*/
#if MIXEDCASE_FILENAMES
#define LEAF_FMT "%c"
#define LEAF_LEN 1
#else
#define LEAF_FMT "%02x"
#define LEAF_LEN 2
#endif
/*

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* Copyright (c) 1998-2008,2009 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 *
@ -42,7 +42,7 @@
#include <tic.h>
#include <term_entry.h>
MODULE_ID("$Id: read_entry.c,v 1.102 2008/08/03 19:33:04 tom Exp $")
MODULE_ID("$Id: read_entry.c,v 1.105 2009/12/06 01:22:26 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
@ -314,7 +314,7 @@ _nc_read_termtype(TERMTYPE *ptr, char *buffer, int limit)
if (need) {
if (ext_str_count >= (MAX_ENTRY_SIZE * 2))
return (TGETENT_NO);
return (TGETENT_NO);
if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0)
return (TGETENT_NO);
TR(TRACE_DATABASE,
@ -404,26 +404,22 @@ _nc_read_tic_entry(char *filename,
/*
* If we are looking in a directory, assume the entry is a file under that,
* according to the normal rules.
*
* FIXME - add caseless-filename fixup.
*/
if (_nc_is_dir_path(path)) {
unsigned need = 4 + strlen(path) + strlen(name);
unsigned need = LEAF_LEN + 3 + strlen(path) + strlen(name);
if (need <= limit)
(void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
if (need <= limit) {
(void) sprintf(filename, "%s/" LEAF_FMT "/%s", path, *name, name);
result = _nc_read_file_entry(filename, tp);
}
}
if (_nc_is_dir_path(path))
result = _nc_read_file_entry(filename, tp);
#if USE_HASHED_DB
else {
static const char suffix[] = DBM_SUFFIX;
DB *capdbp;
unsigned lens = sizeof(suffix) - 1;
unsigned size = strlen(path);
unsigned need = lens + size;
unsigned test = lens + size;
if (need <= limit) {
if (test < limit) {
if (size >= lens
&& !strcmp(path + size - lens, suffix))
(void) strcpy(filename, path);
@ -515,6 +511,7 @@ _nc_read_entry(const char *const name, char *const filename, TERMTYPE *const tp)
{
int code = TGETENT_NO;
sprintf(filename, "%.*s", PATH_MAX - 1, name);
if (strlen(name) == 0
|| strcmp(name, ".") == 0
|| strcmp(name, "..") == 0

View File

@ -54,7 +54,7 @@
#define TRACE_OUT(p) /*nothing */
#endif
MODULE_ID("$Id: write_entry.c,v 1.74 2009/09/19 20:30:48 Daniel.Jacobowitz Exp $")
MODULE_ID("$Id: write_entry.c,v 1.75 2009/12/05 21:25:01 tom Exp $")
static int total_written;
@ -137,10 +137,12 @@ make_db_path(char *dst, const char *src, unsigned limit)
if (_nc_is_dir_path(dst)) {
rc = -1;
} else {
static const char suffix[] = DBM_SUFFIX;
unsigned have = strlen(dst);
if (have > 3 && strcmp(dst + have - 3, DBM_SUFFIX)) {
if (have + 3 <= limit)
strcat(dst, DBM_SUFFIX);
unsigned need = strlen(suffix);
if (have > need && strcmp(dst + have - need, suffix)) {
if (have + need <= limit)
strcat(dst, suffix);
else
rc = -1;
}
@ -362,7 +364,7 @@ _nc_write_entry(TERMTYPE *const tp)
start_time = 0;
}
if (strlen(first_name) >= sizeof(filename) - 3)
if (strlen(first_name) >= sizeof(filename) - (2 + LEAF_LEN))
_nc_warning("terminal name too long.");
sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name);
@ -396,7 +398,7 @@ _nc_write_entry(TERMTYPE *const tp)
if (*other_names != '\0')
*(other_names++) = '\0';
if (strlen(ptr) > sizeof(linkname) - 3) {
if (strlen(ptr) > sizeof(linkname) - (2 + LEAF_LEN)) {
_nc_warning("terminal alias %s too long.", ptr);
continue;
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
* Copyright (c) 1998-2008,2009 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 *
@ -42,7 +42,7 @@
#include <dump_entry.h>
MODULE_ID("$Id: infocmp.c,v 1.103 2008/08/16 22:04:56 tom Exp $")
MODULE_ID("$Id: infocmp.c,v 1.104 2009/12/05 21:10:31 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
@ -1255,6 +1255,15 @@ terminal_env(void)
*
***************************************************************************/
#if NO_LEAKS
#define MAIN_LEAKS() \
free(myargv); \
free(tfile); \
free(tname)
#else
#define MAIN_LEAKS() /* nothing */
#endif
int
main(int argc, char *argv[])
{
@ -1514,6 +1523,7 @@ main(int argc, char *argv[])
#else
(void) fprintf(stderr, "%s: terminfo files not supported\n",
_nc_progname);
MAIN_LEAKS();
ExitProgram(EXIT_FAILURE);
#endif
} else {
@ -1534,6 +1544,7 @@ main(int argc, char *argv[])
"%s: couldn't open terminfo file %s.\n",
_nc_progname,
tfile[termcount]);
MAIN_LEAKS();
ExitProgram(EXIT_FAILURE);
}
repair_acsc(&entries[termcount].tterm);
@ -1642,11 +1653,7 @@ main(int argc, char *argv[])
else
file_comparison(argc - optind, argv + optind);
#if NO_LEAKS
free(myargv);
free(tfile);
free(tname);
#endif
MAIN_LEAKS();
ExitProgram(EXIT_SUCCESS);
}