mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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@eu.citrix.com>
This commit is contained in:
1 parent
a2bfc84506
commit
e4bc73337a
1 file changed
+2
@@ -937,6 +937,8 @@ static char *get_blktap2_device(struct libxl_ctx *ctx, char *name, char *type)
|
||||
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);
|
||||
|
||||