X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/ff530f04a002cad5a849e83d4e16cecc2b528358..83078af5b0b1db4eb185cb256ebb76c117eea110:/util.c diff --git a/util.c b/util.c index 6526a3d9..0887e7fc 100644 --- a/util.c +++ b/util.c @@ -109,13 +109,13 @@ void print_child_argv(char **cmd) rprintf(FCLIENT, "\n"); } -void out_of_memory(char *str) +NORETURN void out_of_memory(char *str) { rprintf(FERROR, "ERROR: out of memory in %s [%s]\n", str, who_am_i()); exit_cleanup(RERR_MALLOC); } -void overflow_exit(char *str) +NORETURN void overflow_exit(char *str) { rprintf(FERROR, "ERROR: buffer overflow in %s [%s]\n", str, who_am_i()); exit_cleanup(RERR_MALLOC); @@ -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]; } }