X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Falloc_entry.c;h=fe7892f4c6184275f806211cec537631213c2a4b;hp=13bb3a020161498f00c3e6dd2b0765cbc01724b8;hb=9208e1bde56ebb9cc550fd93034f1d4650518b11;hpb=5e1e572b71ae31a6071daa24e2460a68a6f1003c;ds=sidebyside diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c index 13bb3a02..fe7892f4 100644 --- a/ncurses/tinfo/alloc_entry.c +++ b/ncurses/tinfo/alloc_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2013,2017 Free Software Foundation, Inc. * + * Copyright (c) 1998-2017,2018 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 -MODULE_ID("$Id: alloc_entry.c,v 1.59 2017/04/09 23:33:51 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.62 2018/04/14 20:32:09 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -96,7 +96,11 @@ _nc_save_str(const char *const string) { char *result = 0; size_t old_next_free = next_free; - size_t len = strlen(string) + 1; + size_t len; + + if (!VALID_STRING(string)) + return _nc_save_str(""); + len = strlen(string) + 1; if (len == 1 && next_free != 0) { /* @@ -225,6 +229,9 @@ _nc_merge_entry(ENTRY * const target, ENTRY * const source) TERMTYPE2 *from = &(source->tterm); unsigned i; + if (source == 0 || from == 0 || target == 0 || to == 0) + return; + #if NCURSES_XNAMES _nc_align_termtype(to, from); #endif