Changed sprintf() calls to snprintf().

This commit is contained in:
Wayne Davison committed 2006-10-13 23:46:32 +00:00
1 parent 185aa5b0e5
commit 83078af5b0
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -1258,8 +1258,8 @@ static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig))
char cmd_buf[300];
int ret;
sprintf(cmd_buf, get_panic_action(),
getpid(), getpid());
snprintf(cmd_buf, sizeof cmd_buf, get_panic_action(),
getpid(), getpid());
/* Unless we failed to execute gdb, we allow the process to
* continue. I'm not sure if that's right. */
+2 -2
View File
@@ -359,7 +359,7 @@ int robust_unlink(const char *fname)
/* start where the last one left off to reduce chance of clashes */
start = counter;
do {
sprintf(&path[pos], "%03d", counter);
snprintf(&path[pos], 4, "%03d", counter);
if (++counter >= MAX_RENAMES)
counter = 1;
} while ((rc = access(path, 0)) == 0 && counter != start);
@@ -1115,7 +1115,7 @@ char *human_num(int64 num)
units = 'K';
}
if (units) {
sprintf(bufs[n], "%.2f%c", dnum, units);
snprintf(bufs[n], sizeof bufs[0], "%.2f%c", dnum, units);
return bufs[n];
}
}