Skip to contentSkip to conversation

iw: fix regression in tx power validation

PATCH In review Felix Fietkau 2 participants 2 messages Nov 7, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iw: fix regression in tx power validation

Only bail out if the last character is *not* \0

---
 phy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
phy.c +1 -1
index 91042b4..d9090fd 100644
@@ -293,7 +293,7 @@ static int handle_txpower(struct nl80211_state *state,
 		}
 
 		mbm = strtol(argv[1], &endptr, 10);
-		if (!*endptr)
+		if (*endptr)
 			return 2;
 		NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
 	} else if (argc != 1)
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 1 line · Felix Fietkau

Only bail out if the last character is *not* \0

Oops, thanks.

Quoted 17 lines
---
 phy.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
phy.c +1 -1
index 91042b4..d9090fd 100644
@@ -293,7 +293,7 @@ static int handle_txpower(struct nl80211_state *state,
 		}
 
 		mbm = strtol(argv[1], &endptr, 10);
-		if (!*endptr)
+		if (*endptr)
 			return 2;
 		NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
 	} else if (argc != 1)