From f05359f6975003197d83ec5a1b78893e01000f99 Mon Sep 17 00:00:00 2001 From: David Garcia Quintas Date: Wed, 22 Feb 2017 15:00:41 -0800 Subject: [PATCH] Set terminator explicitly --- src/core/ext/client_channel/parse_address.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/ext/client_channel/parse_address.c b/src/core/ext/client_channel/parse_address.c index fa0125ee9e2..4b8222824b1 100644 --- a/src/core/ext/client_channel/parse_address.c +++ b/src/core/ext/client_channel/parse_address.c @@ -49,10 +49,10 @@ int parse_unix(grpc_uri *uri, grpc_resolved_address *resolved_addr) { struct sockaddr_un *un = (struct sockaddr_un *)resolved_addr->addr; - memset(un, 0, sizeof(*un)); un->sun_family = AF_UNIX; strncpy(un->sun_path, uri->path, sizeof(un->sun_path) - 1 /* null term'd */); + un->sun_path[sizeof(un->sun_path) - 1] = '\0'; resolved_addr->len = strlen(un->sun_path) + sizeof(un->sun_family) + 1; return 1;