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);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to