]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-log.c
ui-log: ban strcpy()
[ps-cgit] / ui-log.c
index b5cd2f61d3305f15f4201e8faa4bca1b93b4864c..c2f92febc2ee67f91872a82c2b43018d6599a78b 100644 (file)
--- a/ui-log.c
+++ b/ui-log.c
@@ -153,8 +153,8 @@ static int show_commit(struct commit *commit, struct rev_info *revs)
        rem_lines = 0;
 
        revs->diffopt.flags.recursive = 1;
-       diff_tree_oid(&parent->tree->object.oid,
-                     &commit->tree->object.oid,
+       diff_tree_oid(&parent->maybe_tree->object.oid,
+                     &commit->maybe_tree->object.oid,
                      "", &revs->diffopt);
        diffcore_std(&revs->diffopt);
 
@@ -234,7 +234,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs)
                        strbuf_add(&msgbuf, "\n\n", 2);
 
                        /* Place wrap_symbol at position i in info->subject */
-                       strcpy(info->subject + i, wrap_symbol);
+                       strlcpy(info->subject + i, wrap_symbol, subject_len - i + 1);
                }
        }
        cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,