svn commit: r250081 - head/sys/xen/xenstore

Justin T. Gibbs gibbs at FreeBSD.org
Mon Apr 29 23:08:14 UTC 2013


Author: gibbs
Date: Mon Apr 29 23:08:13 2013
New Revision: 250081
URL: http://svnweb.freebsd.org/changeset/base/250081

Log:
  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

Modified:
  head/sys/xen/xenstore/xenstore.c

Modified: head/sys/xen/xenstore/xenstore.c
==============================================================================
--- head/sys/xen/xenstore/xenstore.c	Mon Apr 29 22:54:26 2013	(r250080)
+++ head/sys/xen/xenstore/xenstore.c	Mon Apr 29 23:08:13 2013	(r250081)
@@ -307,7 +307,8 @@ split(char *strings, u_int len, u_int *n
 	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);


More information about the svn-src-head mailing list