ports/150618: [PATCH] sysutils/cpdup: fix off-by-one error

Oliver Fromme olli at secnetix.de
Thu Sep 16 09:40:03 UTC 2010


>Number:         150618
>Category:       ports
>Synopsis:       [PATCH] sysutils/cpdup: fix off-by-one error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 16 09:40:02 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Fromme
>Release:        n/a
>Organization:
secnetix GmbH & Co. KG
		http://www.secnetix.de/bsd
>Environment:

>Description:

There's an off-by-one error in the remote protocol handling.
It leads to spurious, random protocol errors, breaking the
client-server connection (see below).

The problem has been fixed in the DragonFly BSD repository:

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/704cef5251497a4f675f5554fa763c18fb622a5b

The same diff is appended below; it should be added to the
FreeBSD port.  Suggested name:

ports/sysutils/cpdup/files/patch-hclink.c

>How-To-Repeat:

Use cpdup to transfer large amounts of data, e.g. backups.
Sooner or later it'll fail with messages like these:

Assertion failed: (tmp.bytes >= (int)sizeof(tmp) && tmp.bytes < HC_BUFSIZE), function hcc_read_command, file hclink.c, line 182.
Abort trap (core dumped)
 
magic mismatch with host (2065)
Assertion failed: (trans->windex + sizeof(*item) + bytes < HC_BUFSIZE), function hcc_leaf_data, file hclink.c, line 343.

>Fix:

--- hclink.c.orig
+++ hclink.c
@@ -388,7 +388,7 @@ int
 hcc_check_space(hctransaction_t trans, struct HCHead *head, int n, int size)
 {
     size = HCC_ALIGN(size) + n * sizeof(struct HCLeaf);
-    if (size > HC_BUFSIZE - trans->windex) {
+    if (size >= HC_BUFSIZE - trans->windex) {
 	struct HCHead *whead = (void *)trans->wbuf;
 
 	whead->cmd |= HCF_CONTINUE;
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list