diff options
-rw-r--r-- | lib/common/DebugMemLeakFinder.cpp | 6 | ||||
-rw-r--r-- | lib/server/Socket.cpp | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/common/DebugMemLeakFinder.cpp b/lib/common/DebugMemLeakFinder.cpp index 9fcabd81..90372a72 100644 --- a/lib/common/DebugMemLeakFinder.cpp +++ b/lib/common/DebugMemLeakFinder.cpp @@ -420,8 +420,10 @@ extern "C" void memleakfinder_atexit() 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); diff --git a/lib/server/Socket.cpp b/lib/server/Socket.cpp index a450cd93..72c126a8 100644 --- a/lib/server/Socket.cpp +++ b/lib/server/Socket.cpp @@ -92,7 +92,9 @@ void Socket::NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, 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 |