From ab348e6c8b94adfc0d815562c32d504bf1965ade Mon Sep 17 00:00:00 2001 From: om Date: Sat, 12 Jul 2008 15:33:19 +0000 Subject: Increase static buffer size to 44 to account for a full IPv6 CIDR mask: 1111:1111:1111:1111:1111:1111:1111:1111/128 + null terminator. Also remove newlines in returned mask. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9984 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index ff417a8a3..a660fe6ac 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -1103,7 +1103,7 @@ int User::GetProtocolFamily() const char* User::GetCIDRMask(int range) { - static char buf[40]; + static char buf[44]; if (this->ip == NULL) return ""; @@ -1162,7 +1162,7 @@ const char* User::GetCIDRMask(int range) /* And finally, zero the extra bits required. */ v6.s6_addr[15 - bytestozero] = (v6.s6_addr[15 - bytestozero] >> extrabits) << extrabits; - sprintf(buf, "%s/%d\n", inet_ntop(AF_INET6, &v6, buffer, 40), range); + sprintf(buf, "%s/%d", inet_ntop(AF_INET6, &v6, buffer, 40), range); return buf; } break; @@ -1197,7 +1197,7 @@ const char* User::GetCIDRMask(int range) v4.s_addr = 0; } - sprintf(buf, "%s/%d\n", inet_ntop(AF_INET, &v4, buffer, 16), range); + sprintf(buf, "%s/%d", inet_ntop(AF_INET, &v4, buffer, 16), range); return buf; } break; -- cgit v1.3.1-10-gc9f91