Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed overflow() to overflow_exit().
[rsync/rsync.git]
/
util.c
diff --git
a/util.c
b/util.c
index
cde7571
..
234a61e
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-120,7
+120,7
@@
void out_of_memory(char *str)
exit_cleanup(RERR_MALLOC);
}
exit_cleanup(RERR_MALLOC);
}
-void overflow(char *str)
+void overflow
_exit
(char *str)
{
rprintf(FERROR, "ERROR: buffer overflow in %s\n", str);
exit_cleanup(RERR_MALLOC);
{
rprintf(FERROR, "ERROR: buffer overflow in %s\n", str);
exit_cleanup(RERR_MALLOC);
@@
-892,7
+892,7
@@
char *safe_fname(const char *fname)
char *t;
ndx = (ndx + 1) % MAX_SAFE_NAMES;
char *t;
ndx = (ndx + 1) % MAX_SAFE_NAMES;
- for (t = fbuf[ndx]; *fname
&& limit
; fname++) {
+ for (t = fbuf[ndx]; *fname; fname++) {
if (*fname == '\\') {
if ((limit -= 2) < 0)
break;
if (*fname == '\\') {
if ((limit -= 2) < 0)
break;
@@
-904,7
+904,8
@@
char *safe_fname(const char *fname)
sprintf(t, "\\%03o", *(uchar*)fname);
t += 4;
} else {
sprintf(t, "\\%03o", *(uchar*)fname);
t += 4;
} else {
- limit--;
+ if (--limit < 0)
+ break;
*t++ = *fname;
}
}
*t++ = *fname;
}
}