X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fparse_entry.c;h=0e3a8bfad198a7f97dc3a17f63fa796d12ab4c9e;hp=ddbc25204fec882b0bde07bc38c6181d6d3b540a;hb=d4d1d81ab6fc1ad681ff120d925099f947fefcf3;hpb=92e187a3459ab7ce1613a3684ca6642447c73620;ds=sidebyside diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index ddbc2520..0e3a8bfa 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. * + * Copyright (c) 1998-2010,2011 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 * @@ -47,7 +47,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.75 2010/05/01 19:35:09 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.76 2011/07/27 01:14:47 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -203,6 +203,8 @@ _nc_extend_names(ENTRY * entryp, char *name, int token_type) { bad_tc_usage = TRUE; \ _nc_warning("Legacy termcap allows only a trailing tc= clause"); } +#define MAX_NUMBER 0x7fff /* positive shorts only */ + NCURSES_EXPORT(int) _nc_parse_entry(struct entry *entryp, int literal, bool silent) { @@ -444,8 +446,12 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) break; case NUMBER: - entryp->tterm.Numbers[entry_ptr->nte_index] = - (short) _nc_curr_token.tk_valnumber; + if (_nc_curr_token.tk_valnumber > MAX_NUMBER) { + entryp->tterm.Numbers[entry_ptr->nte_index] = MAX_NUMBER; + } else { + entryp->tterm.Numbers[entry_ptr->nte_index] = + (short) _nc_curr_token.tk_valnumber; + } break; case STRING: