Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8484ddd
)
Avoid splitting a multi-byte character when trimming a name.
author
Wayne Davison
<wayned@samba.org>
Fri, 26 Nov 2010 17:35:43 +0000
(09:35 -0800)
committer
Wayne Davison
<wayned@samba.org>
Fri, 26 Nov 2010 17:35:43 +0000
(09:35 -0800)
Fixes bug 7816.
receiver.c
patch
|
blob
|
blame
|
history
diff --git
a/receiver.c
b/receiver.c
index
ba3566b
..
0bc6517
100644
(file)
--- a/
receiver.c
+++ b/
receiver.c
@@
-129,6
+129,14
@@
int get_tmpname(char *fnametmp, const char *fname, BOOL make_unique)
added = maxname - 1;
suf = fnametmp + length + added;
added = maxname - 1;
suf = fnametmp + length + added;
+ /* Trim any dangling high-bit chars if the first-trimmed char (if any) is
+ * also a high-bit char, just in case we cut into a multi-byte sequence.
+ * We are guaranteed to stop because of the leading '.' we added. */
+ if ((int)f[added] & 0x80) {
+ while ((int)suf[-1] & 0x80)
+ suf--;
+ }
+
if (make_unique) {
static unsigned counter_limit;
unsigned counter;
if (make_unique) {
static unsigned counter_limit;
unsigned counter;