Go to file
Ramsay Jones 42fd40db68 Fix a bug in gitfo_read_file()
In particular, when asked to read an empty file, this function
calls malloc() with a zero size allocation request. Standard C
says that the behaviour of malloc() in this case is implementation
defined.

[C99, 7.20.3 says "... If the size of the space requested is zero,
the behavior is implementation-defined: either a null pointer is
returned, or the behavior is as if the size were some nonzero
value, except that the returned pointer shall not be used to
access an object."]

Finesse the issue by over-allocating by one byte. Setting the extra
byte to '\0' may also provide a useful sentinel for text files.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2008-12-30 07:32:16 -08:00
src Fix a bug in gitfo_read_file() 2008-12-30 07:32:16 -08:00
tests Implement git_odb__read_loose() 2008-12-19 07:23:00 -08:00
.gitignore Add pkg-config support. 2008-12-30 07:31:03 -08:00
.HEADER Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
api.doxygen doxygen config: Update path to public headers 2008-12-02 08:45:03 -08:00
CONVENTIONS Move include files to include/git/, drop git_ prefix from file names 2008-11-01 15:42:23 -07:00
COPYING Switch the license from BSD to GPL+libgcc exception 2008-11-01 15:55:47 -07:00
git.git-authors Add Adam Simpkins to list of consenting authors 2008-12-09 08:36:10 -08:00
libgit2.pc.in Add pkg-config support. 2008-12-30 07:31:03 -08:00
Makefile Add pkg-config support. 2008-12-30 07:31:03 -08:00