On Sat, 02 Apr 2016 09:23:29 +0200
"Thomas Schmitt" <[email protected]> wrote:

> Hi,
> 
> it turned out that the code about reading ISRC is potentially
> dangerous because its strdup() relies on MMC-4 specs which promise a
> 0-byte in byte 17 of the reply of READ SUB-CHANNEL.

How about
 strndup(&buf[9], 16);
instead of the additional byte?

From the manual:
The strndup() function is similar, but copies at most n bytes.  If s
is longer than n, only n bytes are copied, and a terminating null
byte ('\0') is added.

Would at least save the constant 25.

Best regards
Leon

Reply via email to