[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxenlight: fix segfault when reading blktap2 devs



Hi all,
this patch fixes a possible segfault when reading from
/sys/class/blktap2/devices, if the line read is empty.


Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

---

diff -r 1b0554b495f8 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Mon Nov 30 14:24:21 2009 +0000
+++ b/tools/libxl/libxl.c       Mon Nov 30 14:24:56 2009 +0000
@@ -940,6 +940,8 @@
     while (!feof(f)) {
         fscanf(f, "%d %s", &devnum, buf);
         p = strchr(buf, ':');
+        if (p == NULL)
+            continue;
         p++;
         if (!strcmp(p, name) && !strncmp(buf, type, 3)) {
             fclose(f);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.