]> wimlib.net Git - wimlib/commitdiff
parse_path_list_file(): Ignore UTF-8 BOM
authorEric Biggers <ebiggers3@gmail.com>
Mon, 30 Dec 2013 08:50:20 +0000 (02:50 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 30 Dec 2013 08:50:20 +0000 (02:50 -0600)
src/pathlist.c

index ada1f302f119b1238a3d6489a1f84f140af43f4c..a611bba82884d2fbd39ce40e47ce0ac624a45c10 100644 (file)
@@ -128,6 +128,11 @@ parse_path_list_file(tchar *buf, size_t buflen,
                line_begin = p;
                line_end = nl;
 
                line_begin = p;
                line_end = nl;
 
+               /* Ignore UTF-8 BOM.  */
+               if (nl - line_begin >= 3 && (u8)line_begin[0] == 0xef &&
+                   (u8)line_begin[1] == 0xbb && (u8)line_begin[2] == 0xbf)
+                       line_begin += 3;
+
                /* Ignore leading whitespace.  */
                while (line_begin < nl && istspace(*line_begin))
                        line_begin++;
                /* Ignore leading whitespace.  */
                while (line_begin < nl && istspace(*line_begin))
                        line_begin++;