Commit c833ab7351f2ebac46740380a81e34482e208dcc
1 parent
71b9b0ca
Fix segv when passing an unknown protocol
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
1 additions
and
1 deletions
block.c
@@ -306,7 +306,7 @@ static BlockDriver *find_image_format(const char *filename) | @@ -306,7 +306,7 @@ static BlockDriver *find_image_format(const char *filename) | ||
306 | 306 | ||
307 | drv = find_protocol(filename); | 307 | drv = find_protocol(filename); |
308 | /* no need to test disk image formats for vvfat */ | 308 | /* no need to test disk image formats for vvfat */ |
309 | - if (strcmp(drv->format_name, "vvfat") == 0) | 309 | + if (drv && strcmp(drv->format_name, "vvfat") == 0) |
310 | return drv; | 310 | return drv; |
311 | 311 | ||
312 | ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); | 312 | ret = bdrv_file_open(&bs, filename, BDRV_O_RDONLY); |