mirror of
https://git.proxmox.com/git/libgit2
synced 2025-07-09 09:44:43 +00:00
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>
This commit is contained in:
parent
24ce105b40
commit
72d6a20be0
@ -154,7 +154,7 @@ cleanup:
|
|||||||
static void index_path(char *path, git_indexer *idx)
|
static void index_path(char *path, git_indexer *idx)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
const char prefix[] = "pack-", suffix[] = ".idx\0";
|
const char prefix[] = "pack-", suffix[] = ".idx";
|
||||||
|
|
||||||
ptr = strrchr(path, '/') + 1;
|
ptr = strrchr(path, '/') + 1;
|
||||||
|
|
||||||
@ -162,7 +162,7 @@ static void index_path(char *path, git_indexer *idx)
|
|||||||
ptr += strlen(prefix);
|
ptr += strlen(prefix);
|
||||||
git_oid_fmt(ptr, &idx->hash);
|
git_oid_fmt(ptr, &idx->hash);
|
||||||
ptr += GIT_OID_HEXSZ;
|
ptr += GIT_OID_HEXSZ;
|
||||||
memcpy(ptr, suffix, strlen(suffix));
|
memcpy(ptr, suffix, strlen(suffix) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int git_indexer_write(git_indexer *idx)
|
int git_indexer_write(git_indexer *idx)
|
||||||
|
Loading…
Reference in New Issue
Block a user