fsck: treat a NUL in a tag header as an error
[gitweb.git] / tag.c
diff --git a/tag.c b/tag.c
index 5b0ac62ed846188ad44ceac41d278ff37ec8bd9d..5b2a06d92b75c7aea3f8cfb1cadb33d9da27f3c6 100644 (file)
--- a/tag.c
+++ b/tag.c
@@ -82,7 +82,7 @@ int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
        nl = memchr(bufptr, '\n', tail - bufptr);
        if (!nl || sizeof(type) <= (nl - bufptr))
                return -1;
-       strncpy(type, bufptr, nl - bufptr);
+       memcpy(type, bufptr, nl - bufptr);
        type[nl - bufptr] = '\0';
        bufptr = nl + 1;