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>

Michael Haggerty committed Sep 15, 2011 at 23:10 UTC 8384d78886eca05cae2a4c1bccaee379d76c1e06
1 file changed +3
refs.c
+3
@@ -504,6 +504,9 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
504 if (flag)
505 *flag = 0;
506
507 + if (check_refname_format(ref, REFNAME_ALLOW_ONELEVEL))
508 + return NULL;
509 +
510 for (;;) {
511 char path[PATH_MAX];
512 struct stat st;