Added
Link Here
|
1 |
--- dao/TeacCdr55.cc.orig 2024-02-17 17:59:23 UTC |
2 |
+++ dao/TeacCdr55.cc |
3 |
@@ -1264,6 +1264,7 @@ CdRawToc *TeacCdr55::getRawToc(int sessionNr, int *len |
4 |
{ |
5 |
unsigned char cmd[10]; |
6 |
unsigned short dataLen; |
7 |
+ unsigned short bufLen; |
8 |
unsigned char *data = NULL;; |
9 |
unsigned char reqData[4]; // buffer for requestion the actual length |
10 |
unsigned char *p = NULL; |
11 |
@@ -1285,19 +1286,20 @@ CdRawToc *TeacCdr55::getRawToc(int sessionNr, int *len |
12 |
} |
13 |
|
14 |
dataLen = ((reqData[0] << 8) | reqData[1]) + 2; |
15 |
+ bufLen = dataLen + (dataLen % 2); |
16 |
|
17 |
log_message(4, "Raw toc data len: %d", dataLen); |
18 |
|
19 |
if (dataLen == 4) |
20 |
return NULL; |
21 |
|
22 |
- data = new unsigned char[dataLen]; |
23 |
+ data = new unsigned char[bufLen]; |
24 |
|
25 |
// read disk toc |
26 |
cmd[7] = dataLen >> 8; |
27 |
cmd[8] = dataLen; |
28 |
|
29 |
- if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { |
30 |
+ if (sendCmd(cmd, 10, NULL, 0, data, bufLen) != 0) { |
31 |
log_message(-2, "Cannot read raw disk toc."); |
32 |
delete[] data; |
33 |
return NULL; |