Fix string matching in parse_bool

This commit is contained in:
David Corbett 2017-12-04 15:15:27 -05:00 committed by Behdad Esfahbod
parent 0fd89dc61c
commit 85bb89a88b
1 changed files with 2 additions and 2 deletions

View File

@ -784,9 +784,9 @@ parse_bool (const char **pp, const char *end, uint32_t *pv)
(*pp)++;
/* CSS allows on/off as aliases 1/0. */
if (*pp - p == 2 || 0 == strncmp (p, "on", 2))
if (*pp - p == 2 && 0 == strncmp (p, "on", 2))
*pv = 1;
else if (*pp - p == 3 || 0 == strncmp (p, "off", 2))
else if (*pp - p == 3 && 0 == strncmp (p, "off", 3))
*pv = 0;
else
return false;