Merge branch 'jk/war-on-sprintf'
Many allocations that is manually counted (correctly) that are followed by strcpy/sprintf have been replaced with a less error prone constructs such as xstrfmt. Macintosh-specific breakage was noticed and corrected in this reroll. * jk/war-on-sprintf: (70 commits) name-rev: use strip_suffix to avoid magic numbers use strbuf_complete to conditionally append slash fsck: use for_each_loose_file_in_objdir Makefile: drop D_INO_IN_DIRENT build knob fsck: drop inode-sorting code convert strncpy to memcpy notes: document length of fanout path with a constant color: add color_set helper for copying raw colors prefer memcpy to strcpy help: clean up kfmclient munging receive-pack: simplify keep_arg computation avoid sprintf and strcpy with flex arrays use alloc_ref rather than hand-allocating "struct ref" color: add overflow checks for parsing colors drop strcpy in favor of raw sha1_to_hex use sha1_to_hex_r() instead of strcpy daemon: use cld->env_array when re-spawning stat_tracking_info: convert to argv_array http-push: use an argv_array for setup_revisions fetch-pack: use argv_array for index-pack / unpack-objects ...
This commit is contained in:
13
transport.c
13
transport.c
@ -654,23 +654,24 @@ static void print_ok_ref_status(struct ref *ref, int porcelain)
|
||||
"[new branch]"),
|
||||
ref, ref->peer_ref, NULL, porcelain);
|
||||
else {
|
||||
char quickref[84];
|
||||
struct strbuf quickref = STRBUF_INIT;
|
||||
char type;
|
||||
const char *msg;
|
||||
|
||||
strcpy(quickref, status_abbrev(ref->old_sha1));
|
||||
strbuf_addstr(&quickref, status_abbrev(ref->old_sha1));
|
||||
if (ref->forced_update) {
|
||||
strcat(quickref, "...");
|
||||
strbuf_addstr(&quickref, "...");
|
||||
type = '+';
|
||||
msg = "forced update";
|
||||
} else {
|
||||
strcat(quickref, "..");
|
||||
strbuf_addstr(&quickref, "..");
|
||||
type = ' ';
|
||||
msg = NULL;
|
||||
}
|
||||
strcat(quickref, status_abbrev(ref->new_sha1));
|
||||
strbuf_addstr(&quickref, status_abbrev(ref->new_sha1));
|
||||
|
||||
print_ref_status(type, quickref, ref, ref->peer_ref, msg, porcelain);
|
||||
print_ref_status(type, quickref.buf, ref, ref->peer_ref, msg, porcelain);
|
||||
strbuf_release(&quickref);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user