From b200a813c090c2ccf12ee4b5a99b45300fead2e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Fri, 14 Sep 2012 20:43:47 +0200 Subject: [PATCH] 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. --- src/config_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;