summaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
Diffstat (limited to 'path.c')
-rw-r--r--path.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/path.c b/path.c
index e50d2befcf..1ca2cf9a28 100644
--- a/path.c
+++ b/path.c
@@ -661,6 +661,10 @@ int validate_headref(const char *path)
len = read_in_full(fd, buffer, sizeof(buffer)-1);
close(fd);
+ if (len < 0)
+ return -1;
+ buffer[len] = '\0';
+
/*
* Is it a symbolic ref?
*/