apply, ls-files: simplify "-z" parsing
[gitweb.git] / builtin / ls-tree.c
index 3b04a0f082a48c7b9c16f57a5bf4be94c159204c..0e30d862303b67ace2c7accf2e7c9346d8f63264 100644 (file)
@@ -96,12 +96,13 @@ static int show_tree(const unsigned char *sha1, struct strbuf *base,
                        if (!strcmp(type, blob_type)) {
                                unsigned long size;
                                if (sha1_object_info(sha1, &size) == OBJ_BAD)
-                                       strcpy(size_text, "BAD");
+                                       xsnprintf(size_text, sizeof(size_text),
+                                                 "BAD");
                                else
-                                       snprintf(size_text, sizeof(size_text),
-                                                "%lu", size);
+                                       xsnprintf(size_text, sizeof(size_text),
+                                                 "%lu", size);
                        } else
-                               strcpy(size_text, "-");
+                               xsnprintf(size_text, sizeof(size_text), "-");
                        printf("%06o %s %s %7s\t", mode, type,
                               find_unique_abbrev(sha1, abbrev),
                               size_text);