stream: Ensure UNIX socket path is null terminated
authorTobias Brunner <tobias@strongswan.org>
Wed, 24 Jul 2013 09:18:31 +0000 (11:18 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 Jul 2013 14:17:23 +0000 (16:17 +0200)
src/libstrongswan/networking/streams/stream.c

index b3dd768..8ecb89f 100644 (file)
@@ -313,6 +313,7 @@ int stream_parse_uri_unix(char *uri, struct sockaddr_un *addr)
        memset(addr, 0, sizeof(*addr));
        addr->sun_family = AF_UNIX;
        strncpy(addr->sun_path, uri, sizeof(addr->sun_path));
+       addr->sun_path[sizeof(addr->sun_path)-1] = '\0';
 
        return offsetof(struct sockaddr_un, sun_path) + strlen(addr->sun_path);
 }