-- sale, use or other dealings in this Software without prior written --
-- authorization. --
-------------------------------------------------------------------------------
--- $Id: NEWS,v 1.1973 2012/11/10 21:44:29 tom Exp $
+-- $Id: NEWS,v 1.1974 2012/11/18 02:16:21 tom Exp $
-------------------------------------------------------------------------------
This is a log of changes that ncurses has gone through since Zeyd started
Changes through 1.9.9e did not credit all contributions;
it is not possible to add this information.
+20121117
+ > fixes based on Coverity report:
+ + add missing braces around FreeAndNull in two places.
+ + various fixes in test/ncurses.c
+ + improve limit-checks in tinfo/make_hash.c, tinfo/read_entry.c
+ + correct malloc size in progs/infocmp.c
+ + guard against negative array indices in test/knight.c
+ + fix off-by-one limit check in test/color_name.h
+ + add null-pointer check in progs/tabs.c, test/bs.c, test/demo_forms.c,
+ test/inchs.c
+ + fix memory-leak in tinfo/lib_setup.c, progs/toe.c,
+ test/clip_printw.c, test/demo_menus.c
+ + delete unused windows in test/chgat.c, test/clip_printw.c,
+ test/insdelln.c, test/newdemo.c on error-return.
+
20121110
+ modify configure macro CF_INCLUDE_DIRS to put $CPPFLAGS after the
local -I include options in case someone has set conflicting -I
# use or other dealings in this Software without prior written #
# authorization. #
##############################################################################
-# $Id: dist.mk,v 1.900 2012/11/10 21:02:17 tom Exp $
+# $Id: dist.mk,v 1.901 2012/11/17 16:48:42 tom Exp $
# Makefile for creating ncurses distributions.
#
# This only needs to be used directly as a makefile by developers, but
# These define the major/minor/patch versions of ncurses.
NCURSES_MAJOR = 5
NCURSES_MINOR = 9
-NCURSES_PATCH = 20121110
+NCURSES_PATCH = 20121117
# We don't append the patch to the version, since this only applies to releases
VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR)
/****************************************************************************
- * Copyright (c) 1998-2009,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2011,2012 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 *
#include <curses.priv.h>
-MODULE_ID("$Id: keyok.c,v 1.12 2011/10/22 17:03:22 tom Exp $")
+MODULE_ID("$Id: keyok.c,v 1.13 2012/11/18 02:14:35 tom Exp $")
/*
* Enable (or disable) ncurses' interpretation of a keycode by adding (or
if (flag) {
while ((s = _nc_expand_try(SP_PARM->_key_ok,
- ch, &count, (size_t) 0)) != 0
- && _nc_remove_key(&(SP_PARM->_key_ok), ch)) {
- code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
- free(s);
- count = 0;
- if (code != OK)
- break;
+ ch, &count, (size_t) 0)) != 0) {
+ if (_nc_remove_key(&(SP_PARM->_key_ok), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_keytry), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ } else {
+ free(s);
+ }
}
} else {
while ((s = _nc_expand_try(SP_PARM->_keytry,
- ch, &count, (size_t) 0)) != 0
- && _nc_remove_key(&(SP_PARM->_keytry), ch)) {
- code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
- free(s);
- count = 0;
- if (code != OK)
- break;
+ ch, &count, (size_t) 0)) != 0) {
+ if (_nc_remove_key(&(SP_PARM->_keytry), ch)) {
+ code = _nc_add_to_try(&(SP_PARM->_key_ok), s, ch);
+ free(s);
+ count = 0;
+ if (code != OK)
+ break;
+ } else {
+ free(s);
+ }
}
}
}
extern int malloc_errfd; /* FIXME */
#endif
-MODULE_ID("$Id: lib_freeall.c,v 1.61 2012/08/25 19:52:47 tom Exp $")
+MODULE_ID("$Id: lib_freeall.c,v 1.62 2012/11/17 23:53:03 tom Exp $")
/*
* Free all ncurses data. This is used for testing only (there's no practical
/* Delete only windows that're not a parent */
for (each_window(SP_PARM, p)) {
+ WINDOW *p_win = &(p->win);
bool found = FALSE;
for (each_window(SP_PARM, q)) {
+ WINDOW *q_win = &(q->win);
if ((p != q)
- && (q->win._flags & _SUBWIN)
- && (&(p->win) == q->win._parent)) {
+ && (q_win->_flags & _SUBWIN)
+ && (p_win == q_win->_parent)) {
found = TRUE;
break;
}
}
if (!found) {
- if (delwin(&(p->win)) != ERR)
+ if (delwin(p_win) != ERR)
deleted = TRUE;
break;
}
/****************************************************************************
- * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 1998-2010,2012 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 *
#include <curses.priv.h>
#include <termcap.h> /* ospeed */
-MODULE_ID("$Id: lib_cur_term.c,v 1.30 2010/12/19 01:38:45 tom Exp $")
+MODULE_ID("$Id: lib_cur_term.c,v 1.31 2012/11/18 02:12:43 tom Exp $")
#undef CUR
#define CUR termp->type.
FreeIfNeeded(termp->_termname);
#if USE_HOME_TERMINFO
- if (_nc_globals.home_terminfo != 0)
+ if (_nc_globals.home_terminfo != 0) {
FreeAndNull(_nc_globals.home_terminfo);
+ }
#endif
#ifdef USE_TERM_DRIVER
if (TCB->drv)
#include <locale.h>
#endif
-MODULE_ID("$Id: lib_setup.c,v 1.150 2012/09/22 18:46:12 tom Exp $")
+MODULE_ID("$Id: lib_setup.c,v 1.151 2012/11/18 00:24:56 tom Exp $")
/****************************************************************************
*
if ((VALID_STRING(cursor_address)
|| (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
&& VALID_STRING(clear_screen)) {
+ free(termp);
ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
} else {
+ free(termp);
ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
}
} else if (hard_copy) {
+ free(termp);
ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname);
}
#endif
#include <ctype.h>
-MODULE_ID("$Id: make_hash.c,v 1.8 2012/02/22 22:40:24 tom Exp $")
+MODULE_ID("$Id: make_hash.c,v 1.9 2012/11/18 01:30:03 tom Exp $")
/*
* _nc_make_hash_table()
#define MAX_COLUMNS BUFSIZ /* this _has_ to be worst-case */
+static int
+count_columns(char **list)
+{
+ int result = 0;
+ if (list != 0) {
+ while (*list++) {
+ ++result;
+ }
+ }
+ return result;
+}
+
static char **
parse_columns(char *buffer)
{
list = parse_columns(buffer);
if (list == 0) /* blank or comment */
continue;
+ if (column > count_columns(list)) {
+ fprintf(stderr, "expected %d columns, have %d:\n%s\n",
+ column,
+ count_columns(list),
+ buffer);
+ exit(EXIT_FAILURE);
+ }
name_table[n].nte_link = -1; /* end-of-hash */
name_table[n].nte_name = strdup(list[column]);
if (!strcmp(list[2], "bool")) {
/****************************************************************************
- * Copyright (c) 1999-2008,2011 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2011,2012 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 *
#include <curses.priv.h>
#include <tic.h>
-MODULE_ID("$Id: name_match.c,v 1.21 2011/08/13 20:23:12 tom Exp $")
+MODULE_ID("$Id: name_match.c,v 1.22 2012/11/18 02:10:17 tom Exp $")
#define FirstName _nc_globals.first_name
#if NO_LEAKS
if (sp == 0) {
- if (FirstName != 0)
+ if (FirstName != 0) {
FreeAndNull(FirstName);
+ }
} else
#endif
{
#include <tic.h>
-MODULE_ID("$Id: read_entry.c,v 1.120 2012/10/27 21:51:07 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.121 2012/11/18 01:18:47 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
}
TR(TRACE_DATABASE, ("READ extended-offsets @%d", offset));
+ if ((unsigned) (ext_str_count + (int) need) >= (MAX_ENTRY_SIZE / 2))
+ return (TGETENT_NO);
if ((ext_str_count || need)
&& !read_shorts(buf, ext_str_count + (int) need))
return (TGETENT_NO);
}
if (need) {
- if (ext_str_count >= (MAX_ENTRY_SIZE * 2))
+ if (ext_str_count >= (MAX_ENTRY_SIZE / 2))
return (TGETENT_NO);
if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0)
return (TGETENT_NO);
-ncurses6 (5.9-20121110) unstable; urgency=low
+ncurses6 (5.9-20121117) unstable; urgency=low
* latest weekly patch
- -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Nov 2012 16:02:42 -0500
+ -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 17 Nov 2012 11:58:08 -0500
ncurses6 (5.9-20120608) unstable; urgency=low
Summary: shared libraries for terminal handling
Name: ncurses6
Release: 5.9
-Version: 20121110
+Version: 20121117
License: X11
Group: Development/Libraries
Source: ncurses-%{release}-%{version}.tgz
#include <dump_entry.h>
-MODULE_ID("$Id: infocmp.c,v 1.122 2012/10/27 19:50:50 tom Exp $")
+MODULE_ID("$Id: infocmp.c,v 1.123 2012/11/17 23:15:10 tom Exp $")
#define L_CURL "{"
#define R_CURL "}"
need = (strlen(entries->tterm.term_names)
+ strlen(type)
+ strlen(fmt));
- initializer = (char *) malloc(need);
+ initializer = (char *) malloc(need + 1);
if (initializer == 0)
failed("any_initializer");
}
#define USE_LIBTINFO
#include <progs.priv.h>
-MODULE_ID("$Id: tabs.c,v 1.24 2012/10/27 19:53:53 tom Exp $")
+MODULE_ID("$Id: tabs.c,v 1.25 2012/11/18 01:21:47 tom Exp $")
static void usage(void) GCC_NORETURN;
}
}
- /*
- * If there is only one value, then it is an option such as "-8".
- */
- if ((n == 0) && (value > 0)) {
- int step = value;
- while (n < max_cols - 1) {
- result[n++] = value;
- value += step;
+ if (result != 0) {
+ /*
+ * If there is only one value, then it is an option such as "-8".
+ */
+ if ((n == 0) && (value > 0)) {
+ int step = value;
+ while (n < max_cols - 1) {
+ result[n++] = value;
+ value += step;
+ }
}
- }
- /*
- * Add the last value, if any.
- */
- result[n++] = value + prior;
- result[n] = 0;
+ /*
+ * Add the last value, if any.
+ */
+ result[n++] = value + prior;
+ result[n] = 0;
+ }
return result;
}
#include <hashed_db.h>
#endif
-MODULE_ID("$Id: toe.c,v 1.69 2012/10/27 20:01:20 tom Exp $")
+MODULE_ID("$Id: toe.c,v 1.70 2012/11/17 23:39:42 tom Exp $")
#define isDotname(name) (!strcmp(name, ".") || !strcmp(name, ".."))
(void) fprintf(stderr,
"%s: couldn't open terminfo file %s.\n",
_nc_progname, name_2);
+ free(cwd_buf);
free(name_2);
+ closedir(entrydir);
+ closedir(termdir);
return (EXIT_FAILURE);
}
* v2.0 featuring strict ANSI/POSIX conformance, November 1993.
* v2.1 with ncurses mouse support, September 1995
*
- * $Id: bs.c,v 1.53 2012/06/09 20:30:32 tom Exp $
+ * $Id: bs.c,v 1.54 2012/11/18 00:57:48 tom Exp $
*/
#include <test.priv.h>
m = " You'll pick up survivors from my %s, I hope...!";
break;
}
- (void) printw(m, ss->name);
+ if (m != 0) {
+ (void) printw(m, ss->name);
+ }
(void) beep();
}
return (hit);
/****************************************************************************
- * Copyright (c) 2006-2009,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 2006-2010,2012 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: chgat.c,v 1.11 2010/05/01 19:12:26 tom Exp $
+ * $Id: chgat.c,v 1.12 2012/11/18 01:55:35 tom Exp $
*
* test-driver for chgat/wchgat/mvchgat/mvwchgat
*/
delwin(win1);
touchwin(win);
} else {
+ if (win1 != 0)
+ delwin(win1);
beep();
}
}
* authorization. *
****************************************************************************/
/*
- * $Id: clip_printw.c,v 1.8 2012/06/09 20:30:32 tom Exp $
+ * $Id: clip_printw.c,v 1.9 2012/11/18 00:39:48 tom Exp $
*
* demonstrate how to use printw without wrapping.
*/
delwin(win1);
touchwin(win);
} else {
+ if (win1)
+ delwin(win1);
beep();
}
}
need = (unsigned) getmaxx(win) - 1;
strcpy(fmt, "%c%s%c");
}
- if ((buffer = typeMalloc(char, need)) != 0) {
+ if ((buffer = typeMalloc(char, need + 1)) != 0) {
for (j = 0; j < need; ++j) {
buffer[j] = (char) ('A' + (j % 26));
}
buffer[need - 1] = '\0';
st.status = clip_wprintw(win, fmt, '[', buffer, ']');
+ free(buffer);
}
break;
case 'w':
/****************************************************************************
- * Copyright (c) 2011 Free Software Foundation, Inc. *
+ * Copyright (c) 2011,2012 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: color_name.h,v 1.3 2011/05/14 17:41:17 tom Exp $
+ * $Id: color_name.h,v 1.4 2012/11/18 01:59:32 tom Exp $
*/
#ifndef __COLORNAME_H
static char temp[20];
const char *result = 0;
- if (color > (int) SIZEOF(the_color_names)) {
+ if (color >= (int) SIZEOF(the_color_names)) {
sprintf(temp, "%d", color);
result = temp;
} else if (color < 0) {
* authorization. *
****************************************************************************/
/*
- * $Id: demo_forms.c,v 1.39 2012/06/09 20:30:32 tom Exp $
+ * $Id: demo_forms.c,v 1.40 2012/11/18 01:22:44 tom Exp $
*
* Demonstrate a variety of functions from the form library.
* Thomas Dickey - 2003/4/26
set_form_sub(f, derwin(w, rows, cols, 1, 2));
box(w, 0, 0);
keypad(w, TRUE);
- }
- if (post_form(f) != E_OK)
- wrefresh(w);
+ if (post_form(f) != E_OK)
+ wrefresh(w);
+ }
}
static void
* authorization. *
****************************************************************************/
/*
- * $Id: demo_menus.c,v 1.36 2012/11/03 19:27:01 tom Exp $
+ * $Id: demo_menus.c,v 1.37 2012/11/18 00:18:54 tom Exp $
*
* Demonstrate a variety of functions from the menu library.
* Thomas Dickey - 2005/4/9
free((char *) blob);
}
free(items);
+ items = 0;
}
#ifdef TRACE
if ((count > 0) && (m == mpTrace)) {
ITEM **ip = items;
- while (*ip)
- free(*ip++);
+ if (ip != 0) {
+ while (*ip)
+ free(*ip++);
+ }
}
#endif
}
}
loaded_file = TRUE;
}
+ if (ap == 0)
+ free(items);
}
}
if (ap == 0) {
/****************************************************************************
- * Copyright (c) 2007,2010 Free Software Foundation, Inc. *
+ * Copyright (c) 2007-2010,2012 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 *
* authorization. *
****************************************************************************/
/*
- * $Id: inchs.c,v 1.11 2010/11/13 23:41:23 tom Exp $
+ * $Id: inchs.c,v 1.12 2012/11/18 01:58:15 tom Exp $
*
* Author: Thomas E Dickey
*/
#define BASE_Y 7
#define MAX_COLS 1024
+static void
+failed(const char *s)
+{
+ int save = errno;
+ endwin();
+ errno = save;
+ perror(s);
+ ExitProgram(EXIT_FAILURE);
+}
+
static bool
Quit(int ch)
{
txtwin = stdscr;
base_y = BASE_Y;
}
+ if (txtwin == 0)
+ failed("cannot create txtwin");
keypad(txtwin, TRUE); /* enable keyboard mapping */
(void) cbreak(); /* take input chars one at a time, no wait for \n */
* authorization. *
****************************************************************************/
/*
- * $Id: insdelln.c,v 1.6 2012/06/09 20:29:33 tom Exp $
+ * $Id: insdelln.c,v 1.7 2012/11/18 00:37:58 tom Exp $
*
* test-driver for deleteln, wdeleteln, insdelln, winsdelln, insertln, winsertln
*/
delwin(win1);
touchwin(win);
} else {
+ if (win1)
+ delwin(win1);
beep();
}
}
* Eric S. Raymond <esr@snark.thyrsus.com> July 22 1995. Mouse support
* added September 20th 1995.
*
- * $Id: knight.c,v 1.31 2010/11/13 20:44:21 tom Exp $
+ * $Id: knight.c,v 1.32 2012/11/17 23:46:31 tom Exp $
*/
#include <test.priv.h>
ny = history[movecount].y;
nx = history[movecount].x;
if (nx < 0 || ny < 0) {
- ny = lastrow;
- nx = lastcol;
+ ny = (lastrow >= 0) ? lastrow : 0;
+ nx = (lastcol >= 0) ? lastcol : 0;
}
movecount = 0;
board[ny][nx] = FALSE;
Author: Eric S. Raymond <esr@snark.thyrsus.com> 1993
Thomas E. Dickey (beginning revision 1.27 in 1996).
-$Id: ncurses.c,v 1.378 2012/10/27 19:37:56 tom Exp $
+$Id: ncurses.c,v 1.379 2012/11/18 00:56:44 tom Exp $
***************************************************************************/
} else if (c == 'g') {
waddstr(win, "getstr test: ");
echo();
- code = wgetn_wstr(win, wint_buf, sizeof(wint_buf) - 1);
+ code = wgetn_wstr(win, wint_buf, BUFSIZ - 1);
noecho();
if (code == ERR) {
wprintw(win, "wgetn_wstr returns an error.");
short pair;
wchar_t wch[10];
+ memset(&ch, 0, sizeof(ch));
if (getbkgrnd(&ch) != ERR) {
if (getcchar(&ch, wch, &attr, &pair, 0) != ERR) {
result = attr;
bool opt_wide = FALSE;
bool opt_nums = FALSE;
bool opt_xchr = FALSE;
- wchar_t buffer[10];
+ wchar_t buffer[80];
WINDOW *helpwin;
if (COLORS * COLORS == COLOR_PAIRS) {
set_form_sub(f, derwin(w, rows, cols, 1, 2));
box(w, 0, 0);
keypad(w, TRUE);
+ if (post_form(f) != E_OK)
+ wrefresh(w);
}
-
- if (post_form(f) != E_OK)
- wrefresh(w);
}
static void
* newdemo.c - A demo program using PDCurses. The program illustrate
* the use of colours for text output.
*
- * $Id: newdemo.c,v 1.36 2012/06/09 19:17:29 tom Exp $
+ * $Id: newdemo.c,v 1.37 2012/11/17 23:27:50 tom Exp $
*/
#include <test.priv.h>
getbegyx(win, by, bx);
sw = w / 3;
sh = h / 3;
- if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL)
+
+ if ((swin1 = subwin(win, sh, sw, by + 3, bx + 5)) == NULL) {
return 1;
- if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL)
+ }
+ if ((swin2 = subwin(win, sh, sw, by + 4, bx + 8)) == NULL) {
+ delwin(swin1);
return 1;
- if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL)
+ }
+ if ((swin3 = subwin(win, sh, sw, by + 5, bx + 11)) == NULL) {
+ delwin(swin1);
+ delwin(swin2);
return 1;
+ }
set_colors(swin1, 8, COLOR_RED, COLOR_BLUE);
werase(swin1);