THRIFT-916 gcc warnings(partial) use snprintf instead of sprintf
authorRoger Meier <roger@apache.org>
Mon, 18 Oct 2010 08:22:57 +0000 (08:22 +0000)
committerRoger Meier <roger@apache.org>
Mon, 18 Oct 2010 08:22:57 +0000 (08:22 +0000)
Patch: Christian Lavoie

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1023682 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/transport/TServerSocket.cpp
lib/cpp/src/transport/TSocket.cpp

index 90a27ce..8608898 100644 (file)
@@ -264,7 +264,7 @@ void TServerSocket::listen() {
     }
 
     address.sun_family = AF_UNIX;
-    sprintf(address.sun_path, path_.c_str());
+    snprintf(address.sun_path, sizeof(address.sun_path), "%s", path_.c_str());
     len = sizeof(address);
 
     do {
index 7a48505..73cb56d 100644 (file)
@@ -219,7 +219,7 @@ void TSocket::openConnection(struct addrinfo *res) {
     }
 
     address.sun_family = AF_UNIX;
-    sprintf(address.sun_path, path_.c_str());
+    snprintf(address.sun_path, sizeof(address.sun_path), "%s", path_.c_str());
     len = sizeof(address);
     ret = connect(socket_, (struct sockaddr *) &address, len);
   } else {