View | Details | Raw Unified | Return to bug 206761
Collapse All | Expand All

(-)b/sys/kern/imgact_binmisc.c (-7 / +6 lines)
Lines 1-5 Link Here
1
/*-
1
/*-
2
 * Copyright (c) 2013-15, Stacey D. Son
2
 * Copyright (c) 2013-16, Stacey D. Son
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
Lines 220-235 imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) Link Here
220
{
220
{
221
	imgact_binmisc_entry_t *ibe;
221
	imgact_binmisc_entry_t *ibe;
222
	char *p;
222
	char *p;
223
	int cnt;
223
224
224
	if (xbe->xbe_msize > IBE_MAGIC_MAX)
225
	if (xbe->xbe_msize > IBE_MAGIC_MAX)
225
		return (EINVAL);
226
		return (EINVAL);
226
227
227
	for(p = xbe->xbe_name; *p != 0; p++)
228
	for(cnt = 0, p = xbe->xbe_name; *p != 0; cnt++, p++)
228
		if (!isascii((int)*p))
229
		if (cnt >= IBE_NAME_MAX || !isascii((int)*p))
229
			return (EINVAL);
230
			return (EINVAL);
230
231
231
	for(p = xbe->xbe_interpreter; *p != 0; p++)
232
	for(cnt = 0, p = xbe->xbe_interpreter; *p != 0; cnt++, p++)
232
		if (!isascii((int)*p))
233
		if (cnt >= IBE_INTERP_LEN_MAX || !isascii((int)*p))
233
			return (EINVAL);
234
			return (EINVAL);
234
235
235
	/* Make sure we don't have any invalid #'s. */
236
	/* Make sure we don't have any invalid #'s. */
Lines 266-273 imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) Link Here
266
267
267
	/* Preallocate a new entry. */
268
	/* Preallocate a new entry. */
268
	ibe = imgact_binmisc_new_entry(xbe);
269
	ibe = imgact_binmisc_new_entry(xbe);
269
	if (!ibe)
270
		return (ENOMEM);
271
270
272
	SLIST_INSERT_HEAD(&interpreter_list, ibe, link);
271
	SLIST_INSERT_HEAD(&interpreter_list, ibe, link);
273
	interp_list_entry_count++;
272
	interp_list_entry_count++;

Return to bug 206761