diff options
author | Vicent Marti <tanoku@gmail.com> | 2013-05-02 17:48:49 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2013-05-02 17:48:49 +0200 |
commit | 822645f6298ae0ff86fa717a79c5b7e105bc4a0d (patch) | |
tree | eebeca91e13b5fe01b72a3b13367f94ffcf0a150 /src/refdb_fs.c | |
parent | 1022db2b6860d602e79169906eee4f299855975b (diff) | |
download | libgit2-822645f6298ae0ff86fa717a79c5b7e105bc4a0d.tar.gz |
refdb_fs: Only strstr the traits line
Diffstat (limited to 'src/refdb_fs.c')
-rw-r--r-- | src/refdb_fs.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/refdb_fs.c b/src/refdb_fs.c index 6a6f589f0..2c45eabb7 100644 --- a/src/refdb_fs.c +++ b/src/refdb_fs.c @@ -216,8 +216,13 @@ static int packed_load(refdb_fs_backend *backend) static const char *traits_header = "# pack-refs with: "; if (git__prefixcmp(buffer_start, traits_header) == 0) { - const char *traits = buffer_start + strlen(traits_header); - const char *traits_end = strchr(traits, '\n'); + char *traits = (char *)buffer_start + strlen(traits_header); + char *traits_end = strchr(traits, '\n'); + + if (traits_end == NULL) + goto parse_failed; + + *traits_end = '\0'; if (strstr(traits, " fully-peeled ") != NULL) { backend->peeling_mode = PEELING_FULL; |