aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/index-pack.c4
-rw-r--r--builtin/unpack-objects.c2
-rw-r--r--fsck.c3
-rwxr-xr-xt/t1450-fsck.sh8
4 files changed, 11 insertions, 6 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index a369f5535..463211767 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -447,7 +447,7 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size,
if (type == OBJ_BLOB && size > big_file_threshold)
buf = fixed_buf;
else
- buf = xmalloc(size);
+ buf = xmallocz(size);
memset(&stream, 0, sizeof(stream));
git_inflate_init(&stream);
@@ -552,7 +552,7 @@ static void *unpack_data(struct object_entry *obj,
git_zstream stream;
int status;
- data = xmalloc(consume ? 64*1024 : obj->size);
+ data = xmallocz(consume ? 64*1024 : obj->size);
inbuf = xmalloc((len < 64*1024) ? len : 64*1024);
memset(&stream, 0, sizeof(stream));
diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 855d94b90..ac6667242 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -91,7 +91,7 @@ static void use(int bytes)
static void *get_data(unsigned long size)
{
git_zstream stream;
- void *buf = xmalloc(size);
+ void *buf = xmallocz(size);
memset(&stream, 0, sizeof(stream));
diff --git a/fsck.c b/fsck.c
index 032419463..10bcb6515 100644
--- a/fsck.c
+++ b/fsck.c
@@ -426,7 +426,8 @@ static int fsck_tag_buffer(struct tag *tag, const char *data,
}
strbuf_addf(&sb, "refs/tags/%.*s", (int)(eol - buffer), buffer);
if (check_refname_format(sb.buf, 0))
- error_func(&tag->object, FSCK_WARN, "invalid 'tag' name: %s", buffer);
+ error_func(&tag->object, FSCK_WARN, "invalid 'tag' name: %.*s",
+ (int)(eol - buffer), buffer);
buffer = eol + 1;
if (!skip_prefix(buffer, "tagger ", &buffer))
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh
index d00b70f99..1f04b8aa3 100755
--- a/t/t1450-fsck.sh
+++ b/t/t1450-fsck.sh
@@ -229,8 +229,12 @@ test_expect_success 'tag with incorrect tag name & missing tagger' '
echo $tag >.git/refs/tags/wrong &&
test_when_finished "git update-ref -d refs/tags/wrong" &&
git fsck --tags 2>out &&
- grep "invalid .tag. name" out &&
- grep "expected .tagger. line" out
+
+ cat >expect <<-EOF &&
+ warning in tag $tag: invalid '\''tag'\'' name: wrong name format
+ warning in tag $tag: invalid format - expected '\''tagger'\'' line
+ EOF
+ test_cmp expect out
'
test_expect_success 'tag with bad tagger' '