diff options
author | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-12 15:33:19 +0000 |
---|---|---|
committer | om <om@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-07-12 15:33:19 +0000 |
commit | ab348e6c8b94adfc0d815562c32d504bf1965ade (patch) | |
tree | 9776c0ac6d134392dab4e7274f912b9b135f50f0 /src/users.cpp | |
parent | 3573a074cf68de3fe1a344a244b1072a15444dbb (diff) |
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
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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; |