[MPlayer-cvslog] CVS: main subopt-helper.c,1.1,1.2
Reimar Döffinger CVS
syncmail at mplayerhq.hu
Sat Jan 1 20:03:24 CET 2005
CVS change done by Reimar Döffinger CVS
Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv5809
Modified Files:
subopt-helper.c
Log Message:
fix string argument parsing (e.g. one char strings were not accepted)
Index: subopt-helper.c
===================================================================
RCS file: /cvsroot/mplayer/main/subopt-helper.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- subopt-helper.c 31 Dec 2004 11:11:24 -0000 1.1
+++ subopt-helper.c 1 Jan 2005 19:03:22 -0000 1.2
@@ -234,23 +234,14 @@
char const * match = strchr( str, ':' );
if ( !match )
- {
- if ( str[1] != '\0' )
- {
- int len = strlen( &str[1] );
- match = str + 1 + len;
- }
- else
- {
- return NULL;
- }
- }
+ match = &str[strlen(str)];
+
+ // empty string or too long
+ if ((match == str) || (match - str > 255))
+ return NULL;
valp->len = match - str;
valp->str = str;
- /* if the length is zero, indicate error */
- if ( valp->len == 0 ) { return NULL; }
-
return match;
}
More information about the MPlayer-cvslog
mailing list