Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2779 by checking
the return code from odph_eth_addr_parse() and failing the call if
dst_mac is unparseable.

Signed-off-by: Bill Fischofer <bill.fischo...@linaro.org>
---
Changes in v2:
- Don't forget to free(local) (Maxim comment)

 example/l3fwd/odp_l3fwd_db.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/example/l3fwd/odp_l3fwd_db.c b/example/l3fwd/odp_l3fwd_db.c
index 082b2c2..0670aa4 100644
--- a/example/l3fwd/odp_l3fwd_db.c
+++ b/example/l3fwd/odp_l3fwd_db.c
@@ -394,7 +394,10 @@ int create_fwd_db_entry(char *input, char **oif, uint8_t 
**dst_mac)
                        *oif = entry->oif;
                        break;
                case 2:
-                       odph_eth_addr_parse(&entry->dst_mac, token);
+                       if (odph_eth_addr_parse(&entry->dst_mac, token) < 0) {
+                               free(local);
+                               return -1;
+                       }
                        *dst_mac = entry->dst_mac.addr;
                        break;
 
-- 
2.9.3

Reply via email to