]> git.ipfire.org Git - thirdparty/iproute2.git/commit
lib/ll_addr: improve ll_addr_n2a() a bit
authorPhil Sutter <phil@nwl.cc>
Tue, 22 Mar 2016 18:35:19 +0000 (19:35 +0100)
committerStephen Hemminger <stephen@networkplumber.org>
Sun, 27 Mar 2016 17:37:35 +0000 (10:37 -0700)
commitf63ed3e629893046aca58a3bb409a3ff909a8fae
tree42ef5ec479a73f7c4d571edc69ac4d052aa6e58c
parent7faf1588a755edb9c9cabbe1d3211265e9826d28
lib/ll_addr: improve ll_addr_n2a() a bit

Apart from making the code a bit more compact and efficient, this also
prevents a potential buffer overflow if the passed buffer is really too
small: Although correctly decrementing the size parameter passed to
snprintf, it could become negative which would then wrap since snprintf
uses (unsigned) size_t for the parameter.

Signed-off-by: Phil Sutter <phil@nwl.cc>
lib/ll_addr.c