# HG changeset patch # User reimar # Date 1104606202 0 # Node ID 90bcd37dba7f784cde1b7a64f57c6ef6c38e4ea2 # Parent eadb2d8d5232bf4d3f0500ab0991d1b5bbbcd6fd fix string argument parsing (e.g. one char strings were not accepted) diff -r eadb2d8d5232 -r 90bcd37dba7f subopt-helper.c --- a/subopt-helper.c Sat Jan 01 18:59:33 2005 +0000 +++ b/subopt-helper.c Sat Jan 01 19:03:22 2005 +0000 @@ -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; }