]> git.ipfire.org Git - thirdparty/curl.git/commit
tftpd: always use curl's own tftp.h
authorPatrick Monnerat <patrick@monnerat.net>
Wed, 20 Sep 2023 12:02:05 +0000 (14:02 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Sep 2023 06:47:07 +0000 (08:47 +0200)
commitbbac7c19e50bcfcdc20cd848ce53e3e7e6929ce0
tree39dc053293d4ef88296fb3bce167b5789520c169
parentd6d458b1cf1bf2c34cd39cff9ef9a0e0070b992c
tftpd: always use curl's own tftp.h

Using the system's provided arpa/tftp.h and optimizing, GCC 12 detects
and reports a stringop-overread warning:

tftpd.c: In function ‘write_behind.isra’:
tftpd.c:485:12: warning: ‘write’ reading between 1 and 2147483647 bytes from a region of size 0 [-Wstringop-overread]
  485 |     return write(test->ofile, writebuf, count);
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from tftpd.c:71:
/usr/include/arpa/tftp.h:58:30: note: source object ‘tu_data’ of size 0
   58 |                         char tu_data[0];        /* data or error string */
      |                              ^~~~~~~

This occurs because writebuf points to this field and the latter
cannot be considered as being of dynamic length because it is not
the last field in the structure. Thus it is bound to its declared
size.

This commit always uses curl's own version of tftp.h where the
target field is last in its structure, effectively avoiding the
warning.

As HAVE_ARPA_TFTP_H is not used anymore, cmake/configure checks for
arpa/tftp.h are removed.

Closes #11897
CMake/Platforms/WindowsCache.cmake
CMakeLists.txt
configure.ac
lib/curl_config.h.cmake
tests/server/tftpd.c