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

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);