diff options
author | Wayne Davison <wayned@samba.org> | 2010-11-26 09:35:43 -0800 |
---|---|---|
committer | Wayne Davison <wayned@samba.org> | 2010-11-26 09:35:43 -0800 |
commit | 9f5c16e51d274ad9c11b58396c0f9627d95611fb (patch) | |
tree | 9f5eb5f0ff2669853ef363b0c5f559d65eece418 /receiver.c | |
parent | 8484ddd3d1e667eb209328c17c389972adc4f14a (diff) | |
download | rsync-9f5c16e51d274ad9c11b58396c0f9627d95611fb.tar.gz |
Avoid splitting a multi-byte character when trimming a name.
Fixes bug 7816.
Diffstat (limited to 'receiver.c')
-rw-r--r-- | receiver.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -129,6 +129,14 @@ int get_tmpname(char *fnametmp, const char *fname, BOOL make_unique) 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; |