mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-20 07:52:43 +00:00
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.
This commit is contained in:
parent
f4ea176fa8
commit
b200a813c0
@ -820,7 +820,7 @@ fail_parse:
|
|||||||
|
|
||||||
static int skip_bom(diskfile_backend *cfg)
|
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))
|
if (cfg->reader.buffer.size < sizeof(utf8_bom))
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user