mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 18:28:25 +00:00
Fix buffer overflow checking in parse_hex().
The inputs to parse_hex are never untrusted data, so not security problem. Thanks to Klaus Eisentraut <klaus.eisentraut@web.de> for finding this.
This commit is contained in:
@@ -524,20 +524,20 @@ void prettyprint_time(char *buf, unsigned int t)
|
||||
int parse_hex(char *in, unsigned char *out, int maxlen,
|
||||
unsigned int *wildcard_mask, int *mac_type)
|
||||
{
|
||||
int mask = 0, i = 0;
|
||||
int done = 0, mask = 0, i = 0;
|
||||
char *r;
|
||||
|
||||
if (mac_type)
|
||||
*mac_type = 0;
|
||||
|
||||
while (maxlen == -1 || i < maxlen)
|
||||
while (!done && (maxlen == -1 || i < maxlen))
|
||||
{
|
||||
for (r = in; *r != 0 && *r != ':' && *r != '-' && *r != ' '; r++)
|
||||
if (*r != '*' && !isxdigit((unsigned char)*r))
|
||||
return -1;
|
||||
|
||||
if (*r == 0)
|
||||
maxlen = i;
|
||||
done = 1;
|
||||
|
||||
if (r != in )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user