X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnx-match.c;h=9f869a765acdcd4d17ee496204dc141f5f940f74;hb=8321fb9c570bd25bb8925e7b5116ab90662113b5;hp=12ea4fb8c520f9b2f2e8cd5f2b8bd0c595b80005;hpb=1e37a2d75196c6e10ac078213ad94afb4f3e219a;p=openvswitch diff --git a/lib/nx-match.c b/lib/nx-match.c index 12ea4fb8..9f869a76 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -747,17 +747,15 @@ static const char * parse_hex_bytes(struct ofpbuf *b, const char *s, unsigned int n) { while (n--) { - int low, high; uint8_t byte; + bool ok; s += strspn(s, " "); - low = hexit_value(*s); - high = low < 0 ? low : hexit_value(s[1]); - if (low < 0 || high < 0) { + byte = hexits_value(s, 2, &ok); + if (!ok) { ovs_fatal(0, "%.2s: hex digits expected", s); } - byte = 16 * low + high; ofpbuf_put(b, &byte, 1); s += 2; }