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>
maint
Michael Haggerty 2011-09-15 23:10:39 +02:00 committed by Junio C Hamano
parent d51b720fca
commit 8384d78886
1 changed files with 3 additions and 0 deletions

3
refs.c
View File

@ -504,6 +504,9 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
if (flag) if (flag)
*flag = 0; *flag = 0;


if (check_refname_format(ref, REFNAME_ALLOW_ONELEVEL))
return NULL;

for (;;) { for (;;) {
char path[PATH_MAX]; char path[PATH_MAX];
struct stat st; struct stat st;