Mercurial > mplayer.hg
comparison stream/stream_cddb.c @ 23452:3e676c9e1e35
Avoiding sscanf in cddb support reading more data with %s than buffer size
author | reimar |
---|---|
date | Tue, 05 Jun 2007 11:13:32 +0000 |
parents | 6606c4f5c78c |
children | acfe034e5386 |
comparison
equal
deleted
inserted
replaced
23451:e43369ba24e0 | 23452:3e676c9e1e35 |
---|---|
375 return -1; | 375 return -1; |
376 } | 376 } |
377 | 377 |
378 switch(status) { | 378 switch(status) { |
379 case 210: | 379 case 210: |
380 ret = sscanf( http_hdr->body, "%d %s %08lx", &status, category, &disc_id); | 380 ret = sscanf( http_hdr->body, "%d %99s %08lx", &status, category, &disc_id); |
381 if( ret!=3 ) { | 381 if( ret!=3 ) { |
382 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); | 382 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); |
383 return -1; | 383 return -1; |
384 } | 384 } |
385 // Check if it's a xmcd database file | 385 // Check if it's a xmcd database file |
436 return -1; | 436 return -1; |
437 } | 437 } |
438 ptr++; | 438 ptr++; |
439 // We have a list of exact/inexact matches, so which one do we use? | 439 // We have a list of exact/inexact matches, so which one do we use? |
440 // So let's take the first one. | 440 // So let's take the first one. |
441 ret = sscanf(ptr, "%s %08lx %s", cddb_data->category, &(cddb_data->disc_id), album_title); | 441 ret = sscanf(ptr, "%99s %08lx %99s", cddb_data->category, &(cddb_data->disc_id), album_title); |
442 if( ret!=3 ) { | 442 if( ret!=3 ) { |
443 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); | 443 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); |
444 return -1; | 444 return -1; |
445 } | 445 } |
446 ptr = strstr(http_hdr->body, album_title); | 446 ptr = strstr(http_hdr->body, album_title); |
473 } | 473 } |
474 | 474 |
475 switch(status) { | 475 switch(status) { |
476 case 200: | 476 case 200: |
477 // Found exact match | 477 // Found exact match |
478 ret = sscanf(http_hdr->body, "%d %s %08lx %s", &status, cddb_data->category, &(cddb_data->disc_id), album_title); | 478 ret = sscanf(http_hdr->body, "%d %99s %08lx %99s", &status, cddb_data->category, &(cddb_data->disc_id), album_title); |
479 if( ret!=4 ) { | 479 if( ret!=4 ) { |
480 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); | 480 mp_msg(MSGT_DEMUX, MSGL_ERR, MSGTR_ParseError); |
481 return -1; | 481 return -1; |
482 } | 482 } |
483 ptr = strstr(http_hdr->body, album_title); | 483 ptr = strstr(http_hdr->body, album_title); |