]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Make buffer related function conversion explicit when narrowing
authorArne Schwabe <arne@rfc2549.org>
Wed, 24 Mar 2021 22:23:27 +0000 (23:23 +0100)
committerGert Doering <gert@greenie.muc.de>
Thu, 25 Mar 2021 10:37:04 +0000 (11:37 +0100)
commit7fc608da4ec388c9209bd009cd5053ac0ff7df38
tree433c21373f059de5aa7ae2640c97e3d4a9779d84
parent5a2ed714d14acb2312d27fe40e300be96d970c27
Make buffer related function conversion explicit when narrowing

Clang and gcc do report many of the narrowing conversion that MSVC
reports, like these:

 warning C4267: 'function': conversion from 'size_t' to 'int', possible
loss of data

This commit changes int to size_t where it is safe
(e.g. checked by buf_size_valid) and add casts where necessary.

In the function buffer_read_from_file the return value of fread is
size_t (at least on Linux/Windows/macOS and cppreference), so fix the
check to actually make sense.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210324222330.455-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21805.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/buffer.c
src/openvpn/buffer.h