git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] index-helper: convert strncpy to memcpy
@ 2016-04-10 23:02 Ramsay Jones
  2016-04-11 22:30 ` David Turner
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2016-04-10 23:02 UTC (permalink / raw)
  To: David Turner, Nguyen Thai Ngoc Duy
  Cc: Jeff King, Junio C Hamano, GIT Mailing-list


see commit eddda371 ("convert strncpy to memcpy", 24-09-2015).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
 index-helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/index-helper.c b/index-helper.c
index 4a8e2ae..00f286a 100644
--- a/index-helper.c
+++ b/index-helper.c
@@ -317,7 +317,7 @@ static int setup_socket(const char *socket_path)
 		return -1;
 
 	address.sun_family = AF_UNIX;
-	strncpy(address.sun_path, socket_path, sizeof(address.sun_path));
+	memcpy(address.sun_path, socket_path, len+1); /* include '\0' */
 
 	if (bind(fd, (struct sockaddr *) &address, sizeof(address)))
 		die_errno(_("failed to bind to socket %s"), socket_path);
-- 
2.8.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-04-11 22:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-10 23:02 [PATCH 2/3] index-helper: convert strncpy to memcpy Ramsay Jones
2016-04-11 22:30 ` David Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).