projects
/
ircu2.10.12-pk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ipmask_parse: Reject a full IPv6 address followed by ::.
[ircu2.10.12-pk.git]
/
ircd
/
ircd_string.c
diff --git
a/ircd/ircd_string.c
b/ircd/ircd_string.c
index 52caed58499033be7ec450e3716fa186446a5e21..ed0349ea45fc20b1d8700cc80c355b82317c0603 100644
(file)
--- a/
ircd/ircd_string.c
+++ b/
ircd/ircd_string.c
@@
-156,6
+156,8
@@
char* ircd_strncpy(char* s1, const char* s2, size_t n)
while (s < endp && (*s++ = *s2++))
;
while (s < endp && (*s++ = *s2++))
;
+ if (s == endp)
+ *s = '\0';
return s1;
}
return s1;
}
@@
-479,12
+481,14
@@
ircd_aton_ip4(const char *input, unsigned int *output, unsigned char *pbits)
*pbits = bits;
return pos;
case '.':
*pbits = bits;
return pos;
case '.':
+ if (++dots > 3)
+ return 0;
if (input[++pos] == '.')
return 0;
if (input[++pos] == '.')
return 0;
- ip |= part << (
24 - 8 * dots++
);
+ ip |= part << (
32 - 8 * dots
);
part = 0;
if (input[pos] == '*') {
part = 0;
if (input[pos] == '*') {
- while (input[++pos] == '*') ;
+ while (input[++pos] == '*'
|| input[pos] == '.'
) ;
if (input[pos] != '\0')
return 0;
if (pbits)
if (input[pos] != '\0')
return 0;
if (pbits)
@@
-574,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 (input[pos] == ':') {
if (colon < 8)
return 0;
+ if (ii == 8)
+ return 0;
colon = ii;
pos++;
}
colon = ii;
pos++;
}
@@
-602,9
+608,11
@@
ipmask_parse(const char *input, struct irc_in_addr *ip, unsigned char *pbits)
*pbits = part;
goto finish;
case '*':
*pbits = part;
goto finish;
case '*':
- while (input[++pos] == '*') ;
+ while (input[++pos] == '*'
|| input[pos] == ':'
) ;
if (input[pos] != '\0' || colon < 8)
return 0;
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;
if (pbits)
*pbits = ii * 16;
return pos;
@@
-618,6
+626,8
@@
ipmask_parse(const char *input, struct irc_in_addr *ip, unsigned char *pbits)
default:
return 0;
}
default:
return 0;
}
+ if (input[pos] != '\0')
+ return 0;
finish:
if (colon < 8) {
unsigned int jj;
finish:
if (colon < 8) {
unsigned int jj;