X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=blobdiff_plain;f=ircd%2Fircd_string.c;h=ed0349ea45fc20b1d8700cc80c355b82317c0603;hp=1ed082d6f34d6073d5d5d59041b4d8d65c7ad99a;hb=b7f25dcf93cc44cd9f5b4132c976e72118bcd44f;hpb=eeebbe9bf464ee89dbc12568cae4cc4be8ca836d diff --git a/ircd/ircd_string.c b/ircd/ircd_string.c index 1ed082d..ed0349e 100644 --- a/ircd/ircd_string.c +++ b/ircd/ircd_string.c @@ -481,9 +481,11 @@ ircd_aton_ip4(const char *input, unsigned int *output, unsigned char *pbits) *pbits = bits; return pos; case '.': + if (++dots > 3) + return 0; if (input[++pos] == '.') return 0; - ip |= part << (24 - 8 * dots++); + ip |= part << (32 - 8 * dots); part = 0; if (input[pos] == '*') { while (input[++pos] == '*' || input[pos] == '.') ; @@ -576,6 +578,8 @@ ipmask_parse(const char *input, struct irc_in_addr *ip, unsigned char *pbits) if (input[pos] == ':') { if (colon < 8) return 0; + if (ii == 8) + return 0; colon = ii; pos++; } @@ -607,6 +611,8 @@ ipmask_parse(const char *input, struct irc_in_addr *ip, unsigned char *pbits) while (input[++pos] == '*' || input[pos] == ':') ; if (input[pos] != '\0' || colon < 8) return 0; + if (part && ii < 8) + ip->in6_16[ii++] = htons(part); if (pbits) *pbits = ii * 16; return pos; @@ -620,6 +626,8 @@ ipmask_parse(const char *input, struct irc_in_addr *ip, unsigned char *pbits) default: return 0; } + if (input[pos] != '\0') + return 0; finish: if (colon < 8) { unsigned int jj;