{"thread":{"id":"41985","subject":"[PATCH 2/3] index-helper: convert strncpy to memcpy","startedAt":"2016-04-10T23:02:00Z","lastAt":"2016-04-11T22:30:54Z","messageCount":2,"participants":["Ramsay Jones","David Turner"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"283115","messageId":"570ADB68.8000705@ramsayjones.plus.com","threadId":"41985","inReplyTo":null,"subject":"[PATCH 2/3] index-helper: convert strncpy to memcpy","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2016-04-10T23:02:00Z","receivedAt":"2016-04-10T23:02:00Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nsee commit eddda371 (\"convert strncpy to memcpy\", 24-09-2015).\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n index-helper.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/index-helper.c b/index-helper.c\nindex 4a8e2ae..00f286a 100644\n--- a/index-helper.c\n+++ b/index-helper.c\n@@ -317,7 +317,7 @@ static int setup_socket(const char *socket_path)\n \t\treturn -1;\n \n \taddress.sun_family = AF_UNIX;\n-\tstrncpy(address.sun_path, socket_path, sizeof(address.sun_path));\n+\tmemcpy(address.sun_path, socket_path, len+1); /* include '\\0' */\n \n \tif (bind(fd, (struct sockaddr *) &address, sizeof(address)))\n \t\tdie_errno(_(\"failed to bind to socket %s\"), socket_path);\n-- \n2.8.0\n"},{"id":"283160","messageId":"1460413854.5540.24.camel@twopensource.com","threadId":"41985","inReplyTo":"570ADB68.8000705@ramsayjones.plus.com","subject":"Re: [PATCH 2/3] index-helper: convert strncpy to memcpy","fromName":"David Turner","fromEmail":"dturner@twopensource.com","sentAt":"2016-04-11T22:30:54Z","receivedAt":"2016-04-11T22:30:54Z","isPatch":true,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"On Mon, 2016-04-11 at 00:02 +0100, Ramsay Jones wrote:\n> see commit eddda371 (\"convert strncpy to memcpy\", 24-09-2015).\n> \n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n>  index-helper.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/index-helper.c b/index-helper.c\n> index 4a8e2ae..00f286a 100644\n> --- a/index-helper.c\n> +++ b/index-helper.c\n> @@ -317,7 +317,7 @@ static int setup_socket(const char *socket_path)\n>  \t\treturn -1;\n>  \n>  \taddress.sun_family = AF_UNIX;\n> -\tstrncpy(address.sun_path, socket_path,\n> sizeof(address.sun_path));\n> +\tmemcpy(address.sun_path, socket_path, len+1); /* include\n> '\\0' */\n>  \n>  \tif (bind(fd, (struct sockaddr *) &address, sizeof(address)))\n>  \t\tdie_errno(_(\"failed to bind to socket %s\"),\n> socket_path);\n\nThanks. \n\nI'm actually going to drop this patch because I'm switching to the unix\n-socket.c helpers, so the affected code no longer exists.  But I\nappreciate the thought anyway.\n"}]}