[PATCH 2/4] iphlpapi: Write an ERR if the sockaddr parsing went wrong.

Stefan Dösinger stefan at codeweavers.com
Sun Apr 12 07:24:55 CDT 2020


It should not happen any more after the previous patch but it is subtle
enough that I think being verbose about it makes sense.

Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
---
 dlls/iphlpapi/ipstats.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 94fb4af5fa..fe4d3f4588 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -1539,6 +1539,12 @@ DWORD WINAPI AllocateAndGetIpForwardTableFromStack(PMIB_IPFORWARDTABLE *ppIpForw
                 continue;
 
              sa = (struct sockaddr *)addrPtr;
+             if (addrPtr + sa->sa_len > next + rtm->rtm_msglen)
+             {
+                ERR ("struct sockaddr extends beyond the route message, %p > %p\n",
+                   addrPtr + sa->sa_len, next + rtm->rtm_msglen );
+             }
+
              ADVANCE (addrPtr, sa);
 
              /* default routes are encoded by length-zero sockaddr */
-- 
2.24.1 (Apple Git-126)




More information about the wine-devel mailing list