summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2012-09-14 20:43:47 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2012-09-14 20:46:34 +0200
commitb200a813c090c2ccf12ee4b5a99b45300fead2e8 (patch)
treeb3903a30deaa5db8a96ce6b40cb549184837db47
parentf4ea176fa83297925cf145082b8f76ad44f88a7c (diff)
downloadlibgit2-b200a813c090c2ccf12ee4b5a99b45300fead2e8.tar.gz
config: fix Unicode BOM detection
Defining the BOM as a string makes the array include the NUL-terminator, which means that the memcpy is going to check for that as well and thus never match for a nonempty file. Define the array as three chars, which makes the size correct.
-rw-r--r--src/config_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/config_file.c b/src/config_file.c
index c575649af..4ba83d1d9 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -820,7 +820,7 @@ fail_parse:
static int skip_bom(diskfile_backend *cfg)
{
- static const char utf8_bom[] = "\xef\xbb\xbf";
+ static const char utf8_bom[] = { '\xef', '\xbb', '\xbf' };
if (cfg->reader.buffer.size < sizeof(utf8_bom))
return 0;