The Samba-Bugzilla – Attachment 7202 Details for
Bug 8654
link-by-hash: Fix (non-exploitable) buffer overflow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
link-by-hash: checksum hash required when copying file
0001-link-by-hash-checksum-hash-required-when-copying-fil.patch (text/plain), 2.16 KB, created by
Chris Dunlop
on 2011-12-17 03:06:25 UTC
(
hide
)
Description:
link-by-hash: checksum hash required when copying file
Filename:
MIME Type:
Creator:
Chris Dunlop
Created:
2011-12-17 03:06:25 UTC
Size:
2.16 KB
patch
obsolete
>From 56ca6f9bc7d0093cdf38289bd5f6a18e00224a4a Mon Sep 17 00:00:00 2001 >From: Chris Dunlop <chris@onthe.net.au> >Date: Sat, 17 Dec 2011 13:18:43 +1100 >Subject: [PATCH] link-by-hash: checksum hash required when copying file > >link-by-hash requires the checksum hash when it's copying a file so that >it can properly link into the link farm. In the absence of this patch >I'm seeing it trying to link to the all-zeros hash name (perhaps if a >previous file had carried a checksum the copy file would link to that >previous checksum?). > >Signed-off-by: Chris Dunlop <chris@onthe.net.au> >--- > util.c | 16 ++++++++++++++++ > 1 files changed, 16 insertions(+), 0 deletions(-) > >diff --git a/util.c b/util.c >index ea9ca7d..7ea9487 100644 >--- a/util.c >+++ b/util.c >@@ -31,9 +31,13 @@ extern int relative_paths; > extern int preserve_times; > extern int preserve_xattrs; > extern int preallocate_files; >+extern int checksum_len; >+extern int checksum_seed; > extern char *module_dir; > extern unsigned int module_dirlen; > extern char *partial_dir; >+extern char *link_by_hash_dir; >+extern char sender_file_sum[MAX_DIGEST_LEN]; > extern filter_rule_list daemon_filter_list; > > int sanitize_paths = 0; >@@ -322,6 +326,10 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) > OFF_T preallocated_len = 0, offset = 0; > #endif > >+ if (link_by_hash_dir) { >+ sum_init(checksum_seed); >+ } >+ > if ((ifd = do_open(source, O_RDONLY, 0)) < 0) { > int save_errno = errno; > rsyserr(FERROR_XFER, errno, "open %s", full_fname(source)); >@@ -379,6 +387,9 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) > errno = save_errno; > return -1; > } >+ if (link_by_hash_dir) { >+ sum_update(buf, len); >+ } > #ifdef PREALLOCATE_NEEDS_TRUNCATE > offset += len; > #endif >@@ -398,6 +409,11 @@ int copy_file(const char *source, const char *dest, int ofd, mode_t mode) > full_fname(source)); > } > >+ if (link_by_hash_dir) { >+ if (sum_end(sender_file_sum) != checksum_len) >+ overflow_exit("checksum_len"); /* Impossible... */ >+ } >+ > #ifdef PREALLOCATE_NEEDS_TRUNCATE > /* Source file might have shrunk since we fstatted it. > * Cut off any extra preallocated zeros from dest file. */ >-- >1.7.0.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 8654
:
7167
|
7168
|
7169
|
7170
|
7173
|
7174
|
7175
|
7176
|
7177
| 7202