Michael Stefaniuc : dnsapi: Use FIELD_OFFSET for the size of a struct with var length array.

Alexandre Julliard julliard at winehq.org
Mon Dec 10 14:00:38 CST 2012


Module: wine
Branch: master
Commit: c0092bcd7602b95fde2ca34be9a6dc02bca1f83a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c0092bcd7602b95fde2ca34be9a6dc02bca1f83a

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Mon Dec 10 10:17:02 2012 +0100

dnsapi: Use FIELD_OFFSET for the size of a struct with var length array.

---

 dlls/dnsapi/query.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/dnsapi/query.c b/dlls/dnsapi/query.c
index 72490c5..2116b11 100644
--- a/dlls/dnsapi/query.c
+++ b/dlls/dnsapi/query.c
@@ -563,7 +563,7 @@ static DNS_STATUS dns_get_serverlist( PIP4_ARRAY addrs, PDWORD len )
     unsigned int size;
     int i;
 
-    size = sizeof(IP4_ARRAY) + sizeof(IP4_ADDRESS) * (_res.nscount - 1);
+    size = FIELD_OFFSET(IP4_ARRAY, AddrArray[_res.nscount]);
     if (!addrs || *len < size)
     {
         *len = size;




More information about the wine-cvs mailing list