浏览代码

Only null terminate the first character

Vincent Milum Jr 7 年之前
父节点
当前提交
79b47b055a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      node/InetAddress.cpp

+ 1 - 1
node/InetAddress.cpp

@@ -139,7 +139,7 @@ char *InetAddress::toString(char buf[64]) const
 
 char *InetAddress::toIpString(char buf[64]) const
 {
-	memset(buf,0,64);
+	buf[0] = (char)0;
 	switch(ss_family) {
 		case AF_INET: {
 			inet_ntop(AF_INET, &reinterpret_cast<const struct sockaddr_in *>(this)->sin_addr.s_addr, buf, INET_ADDRSTRLEN);