[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xen-devel
Subject:    [Xen-devel] [PATCH] libxenlight: fix segfault when reading blktap2
From:       Stefano Stabellini <stefano.stabellini () eu ! citrix ! com>
Date:       2009-11-30 14:27:08
Message-ID: alpine.DEB.2.00.0911301425090.12670 () kaball-desktop
[Download RAW message or body]

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@eu.citrix.com>

---

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@lists.xensource.com
http://lists.xensource.com/xen-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic