xenstored: fix possible, but unlikely, stack overflow
authorMatthew Daley <mattjd@gmail.com>
Tue, 10 Sep 2013 14:34:22 +0000 (02:34 +1200)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 13 Sep 2013 12:15:30 +0000 (13:15 +0100)
...when reading xenbus port from xenfs.

Coverity-ID: 1055741
Signed-off-by: Matthew Daley <mattjd@gmail.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/xenstore/xenstored_linux.c

index 5460ca55734d8da4c8bfb076ae42b2a645e58ce1..cf40213b3b38ca1cb08688382ef33c61d05cf4ff 100644 (file)
@@ -32,7 +32,7 @@ evtchn_port_t xenbus_evtchn(void)
        if (fd == -1)
                return -1;
 
-       rc = read(fd, str, sizeof(str)); 
+       rc = read(fd, str, sizeof(str) - 1);
        if (rc == -1)
        {
                int err = errno;