netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org
Subject: [iproute PATCH v2 1/3] iproute: Check mark value input
Date: Mon, 21 Aug 2017 18:36:50 +0200	[thread overview]
Message-ID: <20170821163652.23752-2-phil@nwl.cc> (raw)
In-Reply-To: <20170821163652.23752-1-phil@nwl.cc>

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
Changes since v1:
- Drop newline from end of error message, invarg() already does that.
---
 ip/iproute.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index cb695ad4141a7..5936e2a978bc7 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -1493,7 +1493,8 @@ static int iproute_list_flush_or_save(int argc, char **argv, int action)
 			id = *argv;
 		} else if (strcmp(*argv, "mark") == 0) {
 			NEXT_ARG();
-			get_unsigned(&mark, *argv, 0);
+			if (get_unsigned(&mark, *argv, 0))
+				invarg("invalid mark value", *argv);
 			filter.markmask = -1;
 		} else if (strcmp(*argv, "via") == 0) {
 			int family;
@@ -1710,7 +1711,8 @@ static int iproute_get(int argc, char **argv)
 			idev = *argv;
 		} else if (matches(*argv, "mark") == 0) {
 			NEXT_ARG();
-			get_unsigned(&mark, *argv, 0);
+			if (get_unsigned(&mark, *argv, 0))
+				invarg("invalid mark value", *argv);
 		} else if (matches(*argv, "oif") == 0 ||
 			   strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
-- 
2.13.1

  reply	other threads:[~2017-08-21 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 16:36 [iproute PATCH v2 0/3] Covscan: Fix for missing error checking Phil Sutter
2017-08-21 16:36 ` Phil Sutter [this message]
2017-08-21 16:36 ` [iproute PATCH v2 2/3] iplink_vrf: Complain if main table is not found Phil Sutter
2017-08-21 16:36 ` [iproute PATCH v2 3/3] devlink: Check return code of strslashrsplit() Phil Sutter
2017-08-22  0:29 ` [iproute PATCH v2 0/3] Covscan: Fix for missing error checking Stephen Hemminger

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=20170821163652.23752-2-phil@nwl.cc \
    --to=phil@nwl.cc \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).