#define TRACE_OUT(p) /*nothing */
#endif
-MODULE_ID("$Id: write_entry.c,v 1.71 2008/07/05 20:06:25 tom Exp $")
+MODULE_ID("$Id: write_entry.c,v 1.72 2008/08/03 19:24:00 tom Exp $")
static int total_written;
char *first_name, *other_names;
char *ptr;
+ assert(strlen(tp->term_names) != 0);
+ assert(strlen(tp->term_names) < sizeof(name_list));
+
(void) strcpy(name_list, tp->term_names);
DEBUG(7, ("Name list = '%s'", name_list));
start_time = 0;
}
- if (strlen(first_name) > sizeof(filename) - 3)
+ if (strlen(first_name) >= sizeof(filename) - 3)
_nc_warning("terminal name too long.");
sprintf(filename, LEAF_FMT "/%s", first_name[0], first_name);
}
while (*other_names != '\0') {
ptr = other_names++;
+ assert(ptr < buffer + sizeof(buffer) - 1);
while (*other_names != '|' && *other_names != '\0')
other_names++;
if (even_boundary(nextfree))
return (ERR);
- nextfree = compute_offsets(tp->Strings + STRCOUNT, tp->ext_Strings, offsets);
+ nextfree = compute_offsets(tp->Strings + STRCOUNT,
+ tp->ext_Strings,
+ offsets);
TRACE_OUT(("after extended string capabilities, nextfree=%d", nextfree));
- nextfree += compute_offsets(tp->ext_Names, extcnt, offsets + tp->ext_Strings);
+
+ if (tp->ext_Strings >= SIZEOF(offsets))
+ return (ERR);
+
+ nextfree += compute_offsets(tp->ext_Names,
+ extcnt,
+ offsets + tp->ext_Strings);
TRACE_OUT(("after extended capnames, nextfree=%d", nextfree));
strmax = tp->ext_Strings + extcnt;