projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Document the --root switch of git-diff-tree
[git.git]
/
sha1_file.c
diff --git
a/sha1_file.c
b/sha1_file.c
index
e6fdaa2
..
ac7bf9f
100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-329,7
+329,7
@@
void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned l
return NULL;
bytes = strlen(buffer) + 1;
return NULL;
bytes = strlen(buffer) + 1;
- buf = xmalloc(*size);
+ buf = xmalloc(
1+
*size);
memcpy(buf, buffer + bytes, stream.total_out - bytes);
bytes = stream.total_out - bytes;
memcpy(buf, buffer + bytes, stream.total_out - bytes);
bytes = stream.total_out - bytes;
@@
-339,6
+339,7
@@
void * unpack_sha1_file(void *map, unsigned long mapsize, char *type, unsigned l
while (inflate(&stream, Z_FINISH) == Z_OK)
/* nothing */;
}
while (inflate(&stream, Z_FINISH) == Z_OK)
/* nothing */;
}
+ buf[*size] = 0;
inflateEnd(&stream);
return buf;
}
inflateEnd(&stream);
return buf;
}