Revision: 7073
http://planeshift.svn.sourceforge.net/planeshift/?rev=7073&view=rev
Author: weltall2
Date: 2011-03-11 08:21:09 +0000 (Fri, 11 Mar 2011)
Log Message:
-----------
changed strcpy to strncpy
Modified Paths:
--------------
trunk/src/common/net/netbase.cpp
Modified: trunk/src/common/net/netbase.cpp
===================================================================
--- trunk/src/common/net/netbase.cpp 2011-03-10 21:45:48 UTC (rev 7072)
+++ trunk/src/common/net/netbase.cpp 2011-03-11 08:21:09 UTC (rev 7073)
@@ -196,12 +196,12 @@
//for win32 for now only inet_ntoa as inet_ntop wasn't supported till vista.
//it has the same degree of compatibility of the previous code and it's supported till win2000
#ifdef WIN32
- strcpy(addrText, inet_ntoa(addr.sin_addr));
+ strncpy(addrText, inet_ntoa(addr.sin_addr), INET_ADDRSTRLEN);
#else
//there was a failure in conversion if null
if(!inet_ntop(addr.sin_family,&addr.sin_addr, addrText, sizeof(addrText)))
{
- strcpy(addrText, "UNKNOWN");
+ strncpy(addrText, "UNKNOWN", INET_ADDRSTRLEN);
}
#endif
@@ -230,12 +230,12 @@
//for win32 for now only inet_ntoa as inet_ntop wasn't supported till vista.
//it has the same degree of compatibility of the previous code and it's supported till win2000
#ifdef WIN32
- strcpy(addrText, inet_ntoa(addr.sin_addr));
+ strncpy(addrText, inet_ntoa(addr.sin_addr), INET_ADDRSTRLEN);
#else
//there was a failure in conversion if null
if(!inet_ntop(addr.sin_family,&addr.sin_addr, addrText, sizeof(addrText)))
{
- strcpy(addrText, "UNKNOWN");
+ strncpy(addrText, "UNKNOWN", INET_ADDRSTRLEN);
}
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|