summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-10-01 16:50:14 +0200
committerDave Barach <openvpp@barachs.net>2020-10-02 11:27:39 +0000
commitc71b56dd5c3127af14eaf22b64d4ef68843dbbb3 (patch)
tree94eb8d59d57169d2120441f620d67f75d95be0f2 /src
parent6614df53509030f1c3faf52512bcd8a9851dec5c (diff)
ip: Fix unformat_ip_prefix
Type: fix Change-Id: I73629ccf7d5a49da3858899dc727cc180fb53003 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/vat/ip_types.c5
-rw-r--r--src/vnet/ip/ip_types.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/vat/ip_types.c b/src/vat/ip_types.c
index 5041c129245..8edcb133f33 100644
--- a/src/vat/ip_types.c
+++ b/src/vat/ip_types.c
@@ -64,9 +64,12 @@ uword
unformat_ip_prefix (unformat_input_t * input, va_list * args)
{
ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
+ /* %d writes more than a u8 */
+ int plen;
if (unformat (input, "%U/%d", unformat_ip_address, &ip_prefix_addr (a),
- &ip_prefix_len (a)))
+ &plen))
{
+ ip_prefix_len (a) = plen;
if ((ip_prefix_version (a) == AF_IP4 && 32 < ip_prefix_len (a)) ||
(ip_prefix_version (a) == AF_IP6 && 128 < ip_prefix_len (a)))
{
diff --git a/src/vnet/ip/ip_types.c b/src/vnet/ip/ip_types.c
index 3d489e4e00d..6e4bb3ba6e4 100644
--- a/src/vnet/ip/ip_types.c
+++ b/src/vnet/ip/ip_types.c
@@ -64,9 +64,12 @@ uword
unformat_ip_prefix (unformat_input_t * input, va_list * args)
{
ip_prefix_t *a = va_arg (*args, ip_prefix_t *);
+ /* %d writes more than a u8 */
+ int plen;
if (unformat (input, "%U/%d", unformat_ip_address, &ip_prefix_addr (a),
- &ip_prefix_len (a)))
+ &plen))
{
+ ip_prefix_len (a) = plen;
if ((ip_prefix_version (a) == AF_IP4 && 32 < ip_prefix_len (a)) ||
(ip_prefix_version (a) == AF_IP6 && 128 < ip_prefix_len (a)))
{