[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#815445: nbd: FTBFS on kfreebsd: *** buffer overflow detected ***: ./nbd-tester-client terminated

tags 815445 + patch
user debian-bsd@lists.debian.org
usertags 815445 + kfreebsd

Hi Wouter,

Thanks for fixing this bug upstream.

Wouter Verhelst wrote:
> I intend to update nbd to a more recent version some time before the
> freeze to include these fixes, but that require a full upstream release
> for which it is too soon right now.

I applied the attached against nbd/1:3.10-1, it builds and passes the
testsuite on kfreebsd-amd64, in case you'd maybe like to cherry-pick it
in the meantime.

Steven Chamberlain
--- a/tests/run/nbd-tester-client.c
+++ b/tests/run/nbd-tester-client.c
@@ -414,7 +414,7 @@
 	memset(&addr, 0, sizeof(struct sockaddr_un));
 	addr.sun_family = AF_UNIX;
-	strncpy(addr.sun_path, unixsock, 107);
+	strncpy(addr.sun_path, unixsock, sizeof addr.sun_path);
 	if(connect(sock, (struct sockaddr*)&addr, sizeof(addr))<0) {
 		strncpy(errstr, strerror(errno), errstr_len);
 		goto err_open;
--- a/nbd-server.c
+++ b/nbd-server.c
@@ -2697,7 +2697,7 @@
 	memset(&sa, 0, sizeof(struct sockaddr_un));
 	sa.sun_family = AF_UNIX;
-	strncpy(sa.sun_path, sockname, 107);
+	strncpy(sa.sun_path, sockname, sizeof sa.sun_path);
 	sock = socket(AF_UNIX, SOCK_STREAM, 0);
 	if(sock < 0) {
 		g_set_error(gerror, NBDS_ERR, NBDS_ERR_SOCKET,

Attachment: signature.asc
Description: Digital signature

Reply to: