summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-19 16:41:35 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-19 16:41:35 +0000
commit57f7b01ee485e95ea5db4d92c6f335741e8ff256 (patch)
tree7e1d986361a272b56081309d41dc0602073d1850 /stream
parent20b28ac75e6a42d61b2bd87c5df725617dba9fc7 (diff)
downloadmpv-57f7b01ee485e95ea5db4d92c6f335741e8ff256.tar.bz2
mpv-57f7b01ee485e95ea5db4d92c6f335741e8ff256.tar.xz
Cached file must be 0-terminated since we use string processing functions on it
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25805 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/stream_cddb.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c
index 70c21eb43e..be6ac9269b 100644
--- a/stream/stream_cddb.c
+++ b/stream/stream_cddb.c
@@ -338,10 +338,10 @@ cddb_read_cache(cddb_data_t *cddb_data) {
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 @@ cddb_read_cache(cddb_data_t *cddb_data) {
close(file_fd);
return -1;
}
+ cddb_data->xmcd_file[cddb_data->xmcd_file_size] = 0;
close(file_fd);