]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
netns_ifaddrs: fix integer comparisons
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 10:11:43 +0000 (12:11 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 3 Sep 2021 11:01:43 +0000 (13:01 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/include/netns_ifaddrs.c

index 7ac80e3d60de6da2cd0522e203566b1e54e2c149..30040b2b71ffb8e9b0c36caeb45b931c90627c09 100644 (file)
@@ -31,7 +31,7 @@
 #define __NETLINK_ALIGN(len) (((len) + 3) & ~3)
 
 #define __NLMSG_OK(nlh, end) \
-       ((char *)(end) - (char *)(nlh) >= sizeof(struct nlmsghdr))
+       ((size_t)((char *)(end) - (char *)(nlh)) >= sizeof(struct nlmsghdr))
 
 #define __NLMSG_NEXT(nlh) \
        (struct nlmsghdr *)((char *)(nlh) + __NETLINK_ALIGN((nlh)->nlmsg_len))
@@ -50,7 +50,7 @@
        (struct rtattr *)((char *)(rta) + __NETLINK_ALIGN((rta)->rta_len))
 
 #define __RTA_OK(nlh, end) \
-       ((char *)(end) - (char *)(rta) >= sizeof(struct rtattr))
+       ((size_t)((char *)(end) - (char *)(rta)) >= sizeof(struct rtattr))
 
 #define __NLMSG_RTAOK(rta, nlh) __RTA_OK(rta, __NLMSG_DATAEND(nlh))