mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-06-11 01:40:05 -04:00
dhcp: Fix conversion warnings
- Use correct type for pointer difference - Make sure that small sizeof sum is treated as int Change-Id: Ie0c0fbf4f7f8b379d46b6755c4eff209acc20fef Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1241 Message-Id: <20251006210127.28679-1-gert@greenie.muc.de> URL: https://sourceforge.net/p/openvpn/mailman/message/59243110/ Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
0e3dd1ccba
commit
d446715c53
1 changed files with 2 additions and 11 deletions
|
|
@ -72,11 +72,6 @@ get_dhcp_message_type(const struct dhcp *dhcp, const int optlen)
|
|||
return -1;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#endif
|
||||
|
||||
static in_addr_t
|
||||
do_extract(struct dhcp *dhcp, int optlen)
|
||||
{
|
||||
|
|
@ -115,7 +110,7 @@ do_extract(struct dhcp *dhcp, int optlen)
|
|||
const int owlen = len + 2; /* len of data to overwrite */
|
||||
uint8_t *src = dest + owlen;
|
||||
uint8_t *end = p + optlen;
|
||||
const int movlen = end - src;
|
||||
const intptr_t movlen = end - src;
|
||||
if (movlen > 0)
|
||||
{
|
||||
memmove(dest, src, movlen); /* overwrite router option */
|
||||
|
|
@ -155,7 +150,7 @@ dhcp_extract_router_msg(struct buffer *ipbuf)
|
|||
struct dhcp_full *df = (struct dhcp_full *)BPTR(ipbuf);
|
||||
const int optlen =
|
||||
BLEN(ipbuf)
|
||||
- (sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphdr) + sizeof(struct dhcp));
|
||||
- (int)(sizeof(struct openvpn_iphdr) + sizeof(struct openvpn_udphdr) + sizeof(struct dhcp));
|
||||
|
||||
if (optlen >= 0 && df->ip.protocol == OPENVPN_IPPROTO_UDP
|
||||
&& df->udp.source == htons(BOOTPS_PORT) && df->udp.dest == htons(BOOTPC_PORT)
|
||||
|
|
@ -190,7 +185,3 @@ dhcp_extract_router_msg(struct buffer *ipbuf)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue