Minor improvements in lease-tools

Limit max interface name to fit into buffer.
Make sure pointer have to be always positive.
Close socket after received reply.
This commit is contained in:
Petr Menšík
2018-08-17 10:20:05 +02:00
committed by Simon Kelley
parent 282eab7952
commit 2b38e3823b
3 changed files with 7 additions and 3 deletions

View File

@@ -83,7 +83,7 @@ static unsigned char *option_find1(unsigned char *p, unsigned char *end, int opt
if (p >= end - 2)
return NULL; /* malformed packet */
opt_len = option_len(p);
if (p >= end - (2 + opt_len))
if (end - p >= (2 + opt_len))
return NULL; /* malformed packet */
if (*p == opt && opt_len >= minsize)
return p;