]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Fix potential buffer overflow in entry_to_env
authorBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 18:02:04 +0000 (18:02 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 28 Jan 2016 13:29:24 +0000 (13:29 +0000)
It appears that an entry of type ENTRY_PREFIX with iaid != 1 and an
exclusion can expand to a string of length up to 154 bytes, whereas we
allocate only 144 bytes per entry.

Also, in case of truncation, snprintf() returns the length of the
un-truncated output so we must not use this to increment buf_len.

Finally some of the lengths given to snprintf() are unnecessarily
generous.  Reduce them so we don't have to increase the allocated
length per entry further.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

No differences found