diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-02-17 21:13:33 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-17 21:13:33 +0300 |
commit | b1a90b68cfa3f9e1e0769c2c9fe0db012a51c818 (patch) | |
tree | b7b82b530ad2bde1eec649dd626a45a8237278ed | |
parent | 790dd332c6986693b731211e49479c74c8a1894c (diff) | |
parent | f58316db0ef1b25506c8cd6cc86b3071243a672a (diff) |
Merge branch 'jk/rerere-xsnprintf'
Some calls to strcpy(3) triggers a false warning from static
analysers that are less intelligent than humans, and reducing the
number of these false hits helps us notice real issues. A few
calls to strcpy(3) in "git rerere" that are already safe has been
rewritten to avoid false wanings.
* jk/rerere-xsnprintf:
rerere: replace strcpy with xsnprintf
-rw-r--r-- | rerere.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -48,7 +48,7 @@ static int has_rerere_resolution(const struct rerere_id *id) static struct rerere_id *new_rerere_id_hex(char *hex) { struct rerere_id *id = xmalloc(sizeof(*id)); - strcpy(id->hex, hex); + xsnprintf(id->hex, sizeof(id->hex), "%s", hex); return id; } @@ -904,7 +904,7 @@ int rerere_forget(struct pathspec *pathspec) static struct rerere_id *dirname_to_id(const char *name) { static struct rerere_id id; - strcpy(id.hex, name); + xsnprintf(id.hex, sizeof(id.hex), "%s", name); return &id; } |