summaryrefslogtreecommitdiff
path: root/src/refs.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-08-16 18:16:44 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-08-16 18:16:44 +0200
commit50a8fd03673f270a2c1ce5159287efeecfbf1217 (patch)
tree70d6ef8a3ed7452d7283c654c901b35b4363c5e4 /src/refs.c
parent3a97bff3dc9361018ccd96f6f6fa077b7f70637c (diff)
downloadlibgit2-50a8fd03673f270a2c1ce5159287efeecfbf1217.tar.gz
Fix the reference character check for Unicode
We need to do an unsigned comparison, as otherwise UTF-8 characters might look like they have the sign bit set and the check will fail. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/refs.c')
-rw-r--r--src/refs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/refs.c b/src/refs.c
index 2e5466886..ecd53a69a 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1647,7 +1647,7 @@ void git_repository__refcache_free(git_refcache *refs)
*****************************************/
static int check_valid_ref_char(char ch)
{
- if (ch <= ' ')
+ if ((unsigned) ch <= ' ')
return GIT_ERROR;
switch (ch) {
@@ -1752,4 +1752,4 @@ int git_reference__normalize_name(char *buffer_out, size_t out_size, const char
int git_reference__normalize_name_oid(char *buffer_out, size_t out_size, const char *name)
{
return normalize_name(buffer_out, out_size, name, 1);
-} \ No newline at end of file
+}