Mercurial > mplayer.hg
changeset 17837:eabc94f30183
fix feature pragma length check
author | reimar |
---|---|
date | Sun, 12 Mar 2006 21:44:22 +0000 |
parents | 71c7c0b02396 |
children | 4ed5dece9d09 |
files | libmpdemux/asf_streaming.c |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/asf_streaming.c Sun Mar 12 20:47:52 2006 +0000 +++ b/libmpdemux/asf_streaming.c Sun Mar 12 21:44:22 2006 +0000 @@ -680,15 +680,13 @@ pragma += 9; end = strstr( pragma, "," ); if( end==NULL ) { - size_t s = strlen(pragma); - if(s > sizeof(features)) { - mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_ASFHTTPParseWarnCuttedPragma,pragma,s,sizeof(features)); - len = sizeof(features); - } else { - len = s; - } + len = strlen(pragma); } else { - len = MIN((unsigned int)(end-pragma),sizeof(features)); + len = (unsigned int)(end-pragma); + } + if(len > sizeof(features) - 1) { + mp_msg(MSGT_NETWORK,MSGL_WARN,MSGTR_MPDEMUX_ASF_ASFHTTPParseWarnCuttedPragma,pragma,s,sizeof(features)); + len = sizeof(features) - 1; } strncpy( features, pragma, len ); features[len]='\0';