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

[Xen-changelog] [xen-unstable] libxenlight: fix segfault when reading blktap2 devs



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1259674478 0
# Node ID c0ceddd46bb0efb0714efb44eed1cfa4a9dd9205
# Parent  1a6a109e48cef8920e2619ecef3c0d69b218d827
libxenlight: fix segfault when reading blktap2 devs

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>
---
 tools/libxl/libxl.c |    2 ++
 1 files changed, 2 insertions(+)

diff -r 1a6a109e48ce -r c0ceddd46bb0 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Dec 01 13:34:10 2009 +0000
+++ b/tools/libxl/libxl.c       Tue Dec 01 13:34:38 2009 +0000
@@ -937,6 +937,8 @@ static char *get_blktap2_device(struct l
     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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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