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:
Keir Fraser committed 2009-12-01 13:34:38 +00:00
1 parent a2bfc84506
commit e4bc73337a
1 file changed
+2
+2
View File
@@ -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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.