libxenlight: fix segfault when reading blktap2 devs
PATCH 1/1 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 <[email protected]>
---
tools/libxl/libxl.c +2 -0
@@ -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);