summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2011-09-15 23:10:39 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-05 13:45:31 -0700
commit8384d78886eca05cae2a4c1bccaee379d76c1e06 (patch)
treeef6710f2ad28d3b23c94c43d1d5fbdc1210362a0
parentremote: avoid passing NULL to read_ref() (diff)
downloadtgif-8384d78886eca05cae2a4c1bccaee379d76c1e06.tar.xz
resolve_ref(): verify that the input refname has the right format
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--refs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/refs.c b/refs.c
index b055501899..ee3e0cc560 100644
--- a/refs.c
+++ b/refs.c
@@ -504,6 +504,9 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
if (flag)
*flag = 0;
+ if (check_refname_format(ref, REFNAME_ALLOW_ONELEVEL))
+ return NULL;
+
for (;;) {
char path[PATH_MAX];
struct stat st;