changeset 1218:b73c078e11e9

Don't allow spaces and don't get confused by -o usesyslogd=yes (option name has another option name as a prefix)
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Dec 2015 22:23:42 +0800
parents 980b7ea2c5ef
children 84cf9062718d de2e39e94c68
files cli-runopts.c
diffstat 1 files changed, 5 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/cli-runopts.c	Tue Dec 15 22:19:41 2015 +0800
+++ b/cli-runopts.c	Tue Dec 15 22:23:42 2015 +0800
@@ -824,29 +824,22 @@
 #endif
 
 static int match_extendedopt(const char** strptr, const char *optname) {
-	int seen_eq = 0;
 	int optlen = strlen(optname);
 	const char *str = *strptr;
 
-	while (isspace(*str)) {
-		++str;
-	}
-
 	if (strncasecmp(str, optname, optlen) != 0) {
 		return DROPBEAR_FAILURE;
 	}
 
 	str += optlen;
 
-	while (isspace(*str) || (!seen_eq && *str == '=')) {
-		if (*str == '=') {
-			seen_eq = 1;
-		}
-		++str;
+	if (*str == '=') {
+		*strptr = str+1;
+		return DROPBEAR_SUCCESS;
+	} else {
+		return DROPBEAR_FAILURE;
 	}
 
-	*strptr = str;
-	return DROPBEAR_SUCCESS;
 }
 
 static int parse_flag_value(const char *value) {