From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH iproute2] utils: relax strtoX checking in get_time_rtt
Date: Tue, 11 Nov 2014 01:38:21 +0100 [thread overview]
Message-ID: <1415666301-24900-1-git-send-email-fw@strlen.de> (raw)
ip route change dev tap0 192.168.7.0/24 rto_min 1ms
Error: argument "1ms" is wrong: "rto_min" value is invalid
get_time_rtt() checks for 's' or 'msec' and converts to milliseconds
if needed.
Fixes: 697ac63905 (utils: fix range checking for get_u32/get_u64 et all)
Signed-off-by: Florian Westphal <fw@strlen.de>
---
lib/utils.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/utils.c b/lib/utils.c
index dc21567..987377b 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -144,8 +144,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
if (t < 0.0)
return -1;
- /* extra non-digits */
- if (!p || p == arg || *p)
+ /* no digits? */
+ if (!p || p == arg)
return -1;
/* over/underflow */
@@ -154,8 +154,8 @@ int get_time_rtt(unsigned *val, const char *arg, int *raw)
} else {
res = strtoul(arg, &p, 0);
- /* empty string or trailing non-digits */
- if (!p || p == arg || *p)
+ /* empty string? */
+ if (!p || p == arg)
return -1;
/* overflow */
--
2.0.4
reply other threads:[~2014-11-11 0:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415666301-24900-1-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox