Commit graph

4 commits

Author SHA1 Message Date
Joakim Gebart 24d15ad9a5 core/net/ip: Prevent (tiny) buffer overflow in resolv_found()
An off-by-one error in resolv_found() could make an strncat() call
overflow by the terminating null byte.

When building with Clang the following warning was shown:

../../../core/net/ip/resolv.c:1458:17: warning: the value of the
      size argument in 'strncat' is too large, might lead to a
      buffer overflow [-Wstrncat-size]
                sizeof(resolv_hostname) - strlen(resolv_hostname));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../core/net/ip/resolv.c:1458:17: note: change the argument to
      be the free space in the destination buffer minus the
      terminating null byte
                sizeof(resolv_hostname) - strlen(resolv_hostname));
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                sizeof(resolv_hostname) - strlen(resolv_hostname) - 1

Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
2014-10-02 12:52:39 +02:00
Oliver Schmidt a94e7e63e2 Avoid compiler warnings. 2014-02-01 00:46:57 +01:00
Adam Dunkels 5f3fe7f7c7 Updated include paths for the moved files under net/ 2014-01-26 23:20:23 +01:00
Adam Dunkels 65eba46be2 Moved all generic IP files into the net/ip module 2014-01-26 23:20:21 +01:00
Renamed from core/net/resolv.c (Browse further)