Commit 83078af5 authored by Wayne Davison's avatar Wayne Davison

Changed sprintf() calls to snprintf().

parent 185aa5b0
...@@ -1258,8 +1258,8 @@ static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig)) ...@@ -1258,8 +1258,8 @@ static RETSIGTYPE rsync_panic_handler(UNUSED(int whatsig))
char cmd_buf[300]; char cmd_buf[300];
int ret; int ret;
sprintf(cmd_buf, get_panic_action(), snprintf(cmd_buf, sizeof cmd_buf, get_panic_action(),
getpid(), getpid()); getpid(), getpid());
/* Unless we failed to execute gdb, we allow the process to /* Unless we failed to execute gdb, we allow the process to
* continue. I'm not sure if that's right. */ * continue. I'm not sure if that's right. */
......
...@@ -359,7 +359,7 @@ int robust_unlink(const char *fname) ...@@ -359,7 +359,7 @@ int robust_unlink(const char *fname)
/* start where the last one left off to reduce chance of clashes */ /* start where the last one left off to reduce chance of clashes */
start = counter; start = counter;
do { do {
sprintf(&path[pos], "%03d", counter); snprintf(&path[pos], 4, "%03d", counter);
if (++counter >= MAX_RENAMES) if (++counter >= MAX_RENAMES)
counter = 1; counter = 1;
} while ((rc = access(path, 0)) == 0 && counter != start); } while ((rc = access(path, 0)) == 0 && counter != start);
...@@ -1115,7 +1115,7 @@ char *human_num(int64 num) ...@@ -1115,7 +1115,7 @@ char *human_num(int64 num)
units = 'K'; units = 'K';
} }
if (units) { if (units) {
sprintf(bufs[n], "%.2f%c", dnum, units); snprintf(bufs[n], sizeof bufs[0], "%.2f%c", dnum, units);
return bufs[n]; return bufs[n];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment