]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-log: ban strncpy()
authorChristian Hesse <mail@eworm.de>
Tue, 28 Aug 2018 16:16:11 +0000 (18:16 +0200)
committerChristian Hesse <mail@eworm.de>
Tue, 11 Sep 2018 06:47:12 +0000 (08:47 +0200)
Git upstream bans strncpy() with commit:

  banned.h: mark strncpy() as banned
  e488b7aba743d23b830d239dcc33d9ca0745a9ad

Signed-off-by: Christian Hesse <mail@eworm.de>
ui-log.c

index c2f92febc2ee67f91872a82c2b43018d6599a78b..3bcb657657e47265ffe499910a7508ad9323287f 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -67,7 +67,7 @@ void show_commit_decorations(struct commit *commit)
        while (deco) {
                struct object_id peeled;
                int is_annotated = 0;
-               strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1);
+               strlcpy(buf, prettify_refname(deco->name), sizeof(buf));
                switch(deco->type) {
                case DECORATION_NONE:
                        /* If the git-core doesn't recognize it,