diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2024-06-06 20:09:47 +1000 |
---|---|---|
committer | Stefano Brivio <sbrivio@redhat.com> | 2024-06-07 20:44:44 +0200 |
commit | c919bbbdd370f86af37e18ca991c936d3bf36cfa (patch) | |
tree | a373f8a31850861d887efe0a13505edefbee9c6d /util.h | |
parent | bda80ef53f5b85917773ccebd3008f560658e342 (diff) | |
download | passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar.gz passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar.bz2 passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar.lz passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar.xz passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.tar.zst passt-c919bbbdd370f86af37e18ca991c936d3bf36cfa.zip |
conf: Safer parsing of MAC addresses
In conf() we parse a MAC address in two places, for the --ns-mac-addr and
the -M options. As well as duplicating code, the logic for this parsing
has several bugs:
* The most serious is that if the given string is shorter than a MAC
address should be, we'll access past the end of it.
* We don't check the endptr supplied by strtol() which means we could
ignore certain erroneous contents
* We never check the separator characters between each octet
* We ignore certain sorts of garbage that follow the MAC address
Correct all these bugs in a new parse_mac() helper.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.h')
0 files changed, 0 insertions, 0 deletions