mirror of
https://github.com/clearml/dropbear
synced 2025-05-09 14:21:22 +00:00
revert removal of space handling, different fix for avoiding option prefix
matches
This commit is contained in:
parent
da108a9327
commit
20bdf3a5b1
@ -824,22 +824,34 @@ badport:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int match_extendedopt(const char** strptr, const char *optname) {
|
static int match_extendedopt(const char** strptr, const char *optname) {
|
||||||
|
int seen_eq = 0;
|
||||||
int optlen = strlen(optname);
|
int optlen = strlen(optname);
|
||||||
const char *str = *strptr;
|
const char *str = *strptr;
|
||||||
|
|
||||||
|
while (isspace(*str)) {
|
||||||
|
++str;
|
||||||
|
}
|
||||||
|
|
||||||
if (strncasecmp(str, optname, optlen) != 0) {
|
if (strncasecmp(str, optname, optlen) != 0) {
|
||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
str += optlen;
|
str += optlen;
|
||||||
|
|
||||||
|
while (isspace(*str) || (!seen_eq && *str == '=')) {
|
||||||
if (*str == '=') {
|
if (*str == '=') {
|
||||||
*strptr = str+1;
|
seen_eq = 1;
|
||||||
return DROPBEAR_SUCCESS;
|
}
|
||||||
} else {
|
++str;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (str-*strptr == optlen) {
|
||||||
|
/* matched just a prefix of optname */
|
||||||
return DROPBEAR_FAILURE;
|
return DROPBEAR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*strptr = str;
|
||||||
|
return DROPBEAR_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_flag_value(const char *value) {
|
static int parse_flag_value(const char *value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user