summaryrefslogtreecommitdiff
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rw-r--r--extras/cdrom_id/cdrom_id.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
index 6d3326bd31..a1135665a9 100644
--- a/extras/cdrom_id/cdrom_id.c
+++ b/extras/cdrom_id/cdrom_id.c
@@ -470,9 +470,13 @@ static int cd_media_toc(int fd)
info("READ TOC: len: %d\n", len);
if (len > sizeof(toc))
return -1;
- if (len < 8)
+ if (len < 2)
return -1;
+ /* empty media has no tracks */
+ if (len < 8)
+ return 0;
+
scsi_cmd_set(&sc, 0, 0x43);
scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */
scsi_cmd_set(&sc, 7, len >> 8);