# HG changeset patch # User reimar # Date 1200760895 0 # Node ID 1d16b891d440fb1725148144ec74c0f867a0e402 # Parent cf1d3164d30c4ad57eae56e04c07c793ffd9f892 Cached file must be 0-terminated since we use string processing functions on it diff -r cf1d3164d30c -r 1d16b891d440 stream/stream_cddb.c --- a/stream/stream_cddb.c Sat Jan 19 16:33:06 2008 +0000 +++ b/stream/stream_cddb.c Sat Jan 19 16:41:35 2008 +0000 @@ -338,10 +338,10 @@ perror("fstat"); file_size = 4096; } else { - file_size = stats.st_size; + file_size = stats.st_size < UINT_MAX ? stats.st_size : UINT_MAX - 1; } - cddb_data->xmcd_file = malloc(file_size); + cddb_data->xmcd_file = malloc(file_size+1); if( cddb_data->xmcd_file==NULL ) { mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_MemAllocFailed); close(file_fd); @@ -353,6 +353,7 @@ close(file_fd); return -1; } + cddb_data->xmcd_file[cddb_data->xmcd_file_size] = 0; close(file_fd);