/****************************************************************************
- * Copyright (c) 1998-2016,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 *
#include <tic.h>
-MODULE_ID("$Id: read_entry.c,v 1.144 2017/10/23 21:20:06 tom Exp $")
+MODULE_ID("$Id: read_entry.c,v 1.147 2018/04/01 01:32:39 tom Exp $")
#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts))
int ext_bool_count = MyNumber(buf + 0);
int ext_num_count = MyNumber(buf + 2);
int ext_str_count = MyNumber(buf + 4);
- int ext_str_size = MyNumber(buf + 6);
+ int ext_str_usage = MyNumber(buf + 6);
int ext_str_limit = MyNumber(buf + 8);
unsigned need = (unsigned) (ext_bool_count + ext_num_count + ext_str_count);
int base = 0;
if ((int) need >= (max_entry_size / 2)
- || ext_str_size >= max_entry_size
+ || ext_str_usage >= max_entry_size
|| ext_str_limit >= max_entry_size
|| ext_bool_count < 0
|| ext_num_count < 0
|| ext_str_count < 0
- || ext_str_size < 0
+ || ext_str_usage < 0
|| ext_str_limit < 0) {
returnDB(TGETENT_NO);
}
TYPE_REALLOC(NCURSES_INT2, ptr->num_Numbers, ptr->Numbers);
TYPE_REALLOC(char *, ptr->num_Strings, ptr->Strings);
- TR(TRACE_DATABASE, ("extended header is %d/%d/%d(%d:%d)",
- ext_bool_count, ext_num_count, ext_str_count,
- ext_str_size, ext_str_limit));
+ TR(TRACE_DATABASE, ("extended header: "
+ "bool %d, "
+ "number %d, "
+ "string %d(%d:%d)",
+ ext_bool_count,
+ ext_num_count,
+ ext_str_count,
+ ext_str_usage,
+ ext_str_limit));
TR(TRACE_DATABASE, ("READ %d extended-booleans @%d",
ext_bool_count, offset));
}
if ((ptr->ext_Strings = UShort(ext_str_count)) != 0) {
+ int check = (ext_bool_count + ext_num_count + ext_str_count);
+
TR(TRACE_DATABASE,
- ("Before computing extended-string capabilities str_count=%d, ext_str_count=%d",
+ ("Before computing extended-string capabilities "
+ "str_count=%d, ext_str_count=%d",
str_count, ext_str_count));
convert_strings(buf, ptr->Strings + str_count, ext_str_count,
ext_str_limit, ptr->ext_str_table);
i, i + str_count,
_nc_visbuf(ptr->Strings[i + str_count])));
ptr->Strings[i + STRCOUNT] = ptr->Strings[i + str_count];
- if (VALID_STRING(ptr->Strings[i + STRCOUNT]))
+ if (VALID_STRING(ptr->Strings[i + STRCOUNT])) {
base += (int) (strlen(ptr->Strings[i + STRCOUNT]) + 1);
+ ++check;
+ }
TR(TRACE_DATABASE, ("... to [%d] %s",
i + STRCOUNT,
_nc_visbuf(ptr->Strings[i + STRCOUNT])));
}
+ TR(TRACE_DATABASE, ("Check table-size: %d/%d", check, ext_str_usage));
+#if 0
+ /*
+ * Phasing in a proper check will be done "later".
+ */
+ if (check != ext_str_usage)
+ returnDB(TGETENT_NO);
+#endif
}
if (need) {