diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-10-05 19:59:34 +0200 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2011-10-05 20:25:28 +0200 |
| commit | 72d6a20be073c2854cca220c851c977171a5a465 (patch) | |
| tree | 3ca04a192dd4d1f5922e502c1b3138895dd5ecbc /src/indexer.c | |
| parent | 24ce105b40caaed209936e6481ed2fa801f5fd7d (diff) | |
| download | libgit2-72d6a20be073c2854cca220c851c977171a5a465.tar.gz | |
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>
Diffstat (limited to 'src/indexer.c')
| -rw-r--r-- | src/indexer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/indexer.c b/src/indexer.c index 23fe3346e..d5f605fdb 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -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) |
