X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/4cff5fa462fa54bdd84c310bd9c9bae9eee849d7..6ce9432d755104c8fb6afe82ddcdfc905d498da7:/util.c diff --git a/util.c b/util.c index 85b2227e..afff767d 100644 --- a/util.c +++ b/util.c @@ -111,13 +111,13 @@ void print_child_argv(char **cmd) void out_of_memory(char *str) { - rprintf(FERROR, "ERROR: out of memory in %s\n", str); + rprintf(FERROR, "ERROR: out of memory in %s [%s]\n", str, who_am_i()); exit_cleanup(RERR_MALLOC); } void overflow_exit(char *str) { - rprintf(FERROR, "ERROR: buffer overflow in %s\n", str); + rprintf(FERROR, "ERROR: buffer overflow in %s [%s]\n", str, who_am_i()); exit_cleanup(RERR_MALLOC); } @@ -922,7 +922,8 @@ void die_on_unsafe_path(char *path, int strip_filename) if ((p = strchr(p, '/')) != NULL) *p = '\0'; if (safe_stat(path, &st) < 0) { - *p++ = '/'; + if (p) + *p = '/'; goto done; } if (S_ISLNK(st.st_mode)) { @@ -1033,7 +1034,8 @@ char *full_fname(const char *fn) } else m1 = m2 = m3 = ""; - asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3); + if (asprintf(&result, "\"%s%s%s\"%s%s%s", p1, p2, fn, m1, m2, m3) <= 0) + out_of_memory("full_fname"); return result; }