]> git.decadent.org.uk Git - odhcp6c.git/commit
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)
commita6bbd1d7f5c25b092f143b579860a44e5b0f929e
tree0e6beba419acc720a25813c18d403042fe382751
parent121a043f6dd1b6c6171dae3c041cb50693eae63f
Fix potential buffer overflow in entry_to_env

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>
src/script.c