1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-20 11:11:24 +00:00

xenstore/xenstore.c:

Prevent access to invalid memory region when listing an empty
	directory in the XenStore.

Reported by:	Bei Guan
MFC after:	1 week
This commit is contained in:
Justin T. Gibbs 2013-04-29 23:08:13 +00:00
parent e47937d1b7
commit 1fa06c0afd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250081

View File

@ -307,7 +307,8 @@ split(char *strings, u_int len, u_int *num)
const char **ret;
/* Protect against unterminated buffers. */
strings[len - 1] = '\0';
if (len > 0)
strings[len - 1] = '\0';
/* Count the strings. */
*num = extract_strings(strings, /*dest*/NULL, len);