X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=path.c;h=a074aea64921eb1fb90f079ede9087e6b8109f6a;hb=6e13921b4f7adcc7316a76c0c4955b85b1589a65;hp=092ce57190cc75882a3766c9aee1df719da8a3d6;hpb=98b35e2c749614446b916230148d66857e8a09f3;p=git.git diff --git a/path.c b/path.c index 092ce5719..a074aea64 100644 --- a/path.c +++ b/path.c @@ -41,7 +41,7 @@ char *mksnpath(char *buf, size_t n, const char *fmt, ...) len = vsnprintf(buf, n, fmt, args); va_end(args); if (len >= n) { - snprintf(buf, n, bad_path); + strlcpy(buf, bad_path, n); return buf; } return cleanup_path(buf); @@ -63,7 +63,7 @@ static char *git_vsnpath(char *buf, size_t n, const char *fmt, va_list args) goto bad; return cleanup_path(buf); bad: - snprintf(buf, n, bad_path); + strlcpy(buf, bad_path, n); return buf; } @@ -402,7 +402,7 @@ int normalize_absolute_path(char *buf, const char *path) goto next; } - memcpy(dst, comp_start, comp_len); + memmove(dst, comp_start, comp_len); dst += comp_len; next: comp_start = comp_end;