* Enlarged the identify TOC buffer to 2048 bytes just to be sure.
* Minor cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36984 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
98694dd385
commit
36f016ddbe
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2007-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -588,14 +588,13 @@ read_table_of_contents(int fd, scsi_toc_toc *toc, size_t length)
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
// make sure the values in the TOC make sense
|
||||
|
||||
int32 lastTrack = toc->last_track + 1 - toc->first_track;
|
||||
size_t dataLength = B_BENDIAN_TO_HOST_INT16(toc->data_length) + 2;
|
||||
if (dataLength < sizeof(scsi_toc_toc)
|
||||
|| lastTrack <= 0)
|
||||
if (dataLength < sizeof(scsi_toc_toc) || lastTrack <= 0)
|
||||
return B_BAD_DATA;
|
||||
|
||||
// make sure the values in the TOC make sense
|
||||
|
||||
if (length > dataLength)
|
||||
length = dataLength;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007-2009, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Copyright 2007-2010, Axel Dörfler, axeld@pinc-software.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -1363,11 +1363,11 @@ Inode::RewindAttrCookie(attr_cookie* cookie)
|
||||
static float
|
||||
cdda_identify_partition(int fd, partition_data* partition, void** _cookie)
|
||||
{
|
||||
scsi_toc_toc* toc = (scsi_toc_toc*)malloc(1024);
|
||||
scsi_toc_toc* toc = (scsi_toc_toc*)malloc(2048);
|
||||
if (toc == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
status_t status = read_table_of_contents(fd, toc, 1024);
|
||||
status_t status = read_table_of_contents(fd, toc, 2048);
|
||||
|
||||
// there has to be at least a single audio track
|
||||
if (status == B_OK && count_audio_tracks(toc) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user