Commit 72d6a20b by Carlos Martín Nieto

indexer: NUL-terminate the filename

As we no longer use the STRLEN macro, the NUL-terminator in the string
was not copied over. Fix this.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent 24ce105b
......@@ -154,7 +154,7 @@ cleanup:
static void index_path(char *path, git_indexer *idx)
{
char *ptr;
const char prefix[] = "pack-", suffix[] = ".idx\0";
const char prefix[] = "pack-", suffix[] = ".idx";
ptr = strrchr(path, '/') + 1;
......@@ -162,7 +162,7 @@ static void index_path(char *path, git_indexer *idx)
ptr += strlen(prefix);
git_oid_fmt(ptr, &idx->hash);
ptr += GIT_OID_HEXSZ;
memcpy(ptr, suffix, strlen(suffix));
memcpy(ptr, suffix, strlen(suffix) + 1);
}
int git_indexer_write(git_indexer *idx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment