# HG changeset patch # User reimar # Date 1181042012 0 # Node ID 3e676c9e1e35372b12465da62e46ad2258509fd4 # Parent e43369ba24e08bcc550693d608367268d7a98018 Avoiding sscanf in cddb support reading more data with %s than buffer size diff -r e43369ba24e0 -r 3e676c9e1e35 stream/stream_cddb.c --- a/stream/stream_cddb.c Tue Jun 05 10:05:09 2007 +0000 +++ b/stream/stream_cddb.c Tue Jun 05 11:13:32 2007 +0000 @@ -377,7 +377,7 @@ switch(status) { case 210: - ret = sscanf( http_hdr->body, "%d %s %08lx", &status, category, &disc_id); + ret = sscanf( http_hdr->body, "%d %99s %08lx", &status, category, &disc_id); if( ret!=3 ) { mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); return -1; @@ -438,7 +438,7 @@ ptr++; // We have a list of exact/inexact matches, so which one do we use? // So let's take the first one. - ret = sscanf(ptr, "%s %08lx %s", cddb_data->category, &(cddb_data->disc_id), album_title); + ret = sscanf(ptr, "%99s %08lx %99s", cddb_data->category, &(cddb_data->disc_id), album_title); if( ret!=3 ) { mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); return -1; @@ -475,7 +475,7 @@ switch(status) { case 200: // Found exact match - ret = sscanf(http_hdr->body, "%d %s %08lx %s", &status, cddb_data->category, &(cddb_data->disc_id), album_title); + ret = sscanf(http_hdr->body, "%d %99s %08lx %99s", &status, cddb_data->category, &(cddb_data->disc_id), album_title); if( ret!=4 ) { mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); return -1;