Browse Source

Fix length of the allocated byte array in GetIP() function

nxrighthere 7 years ago
parent
commit
4b564aef78
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Source/Managed/ENet.cs

+ 2 - 2
Source/Managed/ENet.cs

@@ -122,9 +122,9 @@ namespace ENet {
 		}
 		}
 
 
 		public string GetIP() {
 		public string GetIP() {
-			byte[] data = new byte[256];
+			byte[] data = new byte[16];
 
 
-			if (Native.enet_address_get_host_ip(ref nativeAddress, data, (IntPtr)256) == 0)
+			if (Native.enet_address_get_host_ip(ref nativeAddress, data, (IntPtr)16) == 0)
 				return Encoding.ASCII.GetString(data);
 				return Encoding.ASCII.GetString(data);
 			else
 			else
 				return String.Empty;
 				return String.Empty;