]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/hashcomp.cpp
Added some missing parameter checking in m_swhois
[user/henk/code/inspircd.git] / src / hashcomp.cpp
index 55bad8bf7a59bbc59be889e2c2d6b446f4d3e316..caf93ec1be9ebec29ca450d6476aeaeef93842da 100644 (file)
@@ -290,19 +290,17 @@ std::string irc::hex(const unsigned char *raw, size_t rawsz)
        /* EWW! This used to be using sprintf, which is WAY inefficient. -Special */
        
        const char *hex = "0123456789abcdef";
-
-       std::string buf;
-       buf.reserve(rawsz * 2 + 1);
+       static char hexbuf[MAXBUF];
 
        size_t i, j;
        for (i = 0, j = 0; j < rawsz; ++j)
        {
-               buf[i++] = hex[raw[j] / 16];
-               buf[i++] = hex[raw[j] % 16];
+               hexbuf[i++] = hex[raw[j] / 16];
+               hexbuf[i++] = hex[raw[j] % 16];
        }
-       buf[i] = '\0';
+       hexbuf[i] = 0;
 
-       return buf;
+       return hexbuf;
 }
 
 CoreExport const char* irc::Spacify(const char* n)