[Box Backup-commit] COMMIT r2366 - in box/trunk/lib: common server
boxbackup-dev@boxbackup.org
boxbackup-dev@boxbackup.org
Sun, 26 Oct 2008 23:36:44 +0000 (GMT)
Author: chris
Date: 2008-10-26 23:36:44 +0000 (Sun, 26 Oct 2008)
New Revision: 2366
Modified:
box/trunk/lib/common/DebugMemLeakFinder.cpp
box/trunk/lib/server/Socket.cpp
Log:
Silence warnings from openbsd gcc by using strncpy instead of strcpy.
Modified: box/trunk/lib/common/DebugMemLeakFinder.cpp
===================================================================
--- box/trunk/lib/common/DebugMemLeakFinder.cpp 2008-10-26 23:36:05 UTC (rev 2365)
+++ box/trunk/lib/common/DebugMemLeakFinder.cpp 2008-10-26 23:36:44 UTC (rev 2366)
@@ -420,8 +420,10 @@
void memleakfinder_setup_exit_report(const char *filename, const char *markertext)
{
- ::strcpy(atexit_filename, filename);
- ::strcpy(atexit_markertext, markertext);
+ ::strncpy(atexit_filename, filename, sizeof(atexit_filename)-1);
+ ::strncpy(atexit_markertext, markertext, sizeof(atexit_markertext)-1);
+ atexit_filename[sizeof(atexit_filename)-1] = 0;
+ atexit_markertext[sizeof(atexit_markertext)-1] = 0;
if(!atexit_registered)
{
atexit(memleakfinder_atexit);
Modified: box/trunk/lib/server/Socket.cpp
===================================================================
--- box/trunk/lib/server/Socket.cpp 2008-10-26 23:36:05 UTC (rev 2365)
+++ box/trunk/lib/server/Socket.cpp 2008-10-26 23:36:44 UTC (rev 2366)
@@ -92,7 +92,9 @@
addr.sa_unix.sun_len = sockAddrLen;
#endif
addr.sa_unix.sun_family = PF_UNIX;
- ::strcpy(addr.sa_unix.sun_path, rName.c_str());
+ ::strncpy(addr.sa_unix.sun_path, rName.c_str(),
+ sizeof(addr.sa_unix.sun_path) - 1);
+ addr.sa_unix.sun_path[sizeof(addr.sa_unix.sun_path)-1] = 0;
}
break;
#endif