From: Joshua Drake Date: Mon, 30 Nov 2015 21:19:29 +0000 (-0800) Subject: Merge branch 'master' of vcs.fsf.org:p0f-client-exim X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=bb1999ec60795db66218c69f8b153cd1b29100b5;p=p0f-client-exim.git Merge branch 'master' of vcs.fsf.org:p0f-client-exim Conflicts: p0f-client-exim.c --- bb1999ec60795db66218c69f8b153cd1b29100b5 diff --cc p0f-client-exim.c index d26f5fa,717c49a..923e169 --- a/p0f-client-exim.c +++ b/p0f-client-exim.c @@@ -40,13 -40,13 +40,13 @@@ static void parse_addr4(char* str, u8* if (sscanf(str, "%u.%u.%u.%u", &a1, &a2, &a3, &a4) != 4) { SAYF("Malformed IPv4 address."); -- exit(1); -- } ++ exit(1); ++ } - if (a1 > 255 || a2 > 255 || a3 > 255 || a3 > 255) { + if (a1 > 255 || a2 > 255 || a3 > 255 || a4 > 255) { SAYF("Malformed IPv4 address."); -- exit(1); -- } ++ exit(1); ++ } ret[0] = a1; ret[1] = a2; @@@ -70,12 -70,11 +70,11 @@@ static void parse_addr6(char* str, u8* exit(1); } - - if (sscanf((char*)str, "%x", &val) != 1 || - val > 65535) { - SAYF("Malformed IPv6 address (bad octet value)."); - exit(1); - } + if (*str == ':') { val = 0; } + else if (sscanf((char*)str, "%x", &val) != 1 || val > 65535) { + SAYF("Malformed IPv6 address (bad octet value)."); + exit(1); + } ret[seg * 2] = val >> 8; ret[seg * 2 + 1] = val; @@@ -87,11 -86,11 +86,10 @@@ } - if (seg != 8) { - SAYF("Malformed IPv6 address (don't abbreviate)."); - exit(1); - } - + if (seg != 6) { + SAYF("Malformed IPv6 address (incorrect number of segments parsed)"); + exit(1); + } - }