chiark / gitweb /
SECURITY: pa_soa: Do not sign extend SOA 32-bit integer fields on 64-bit
[adns.git] / src / types.c
index 5e2bd14d06082ce3d2b802b8cf83605675fb7a70..d249ca2e64f578d7022c78ff5d90ca94a3ca22f9 100644 (file)
@@ -1371,7 +1371,7 @@ static adns_status pa_soa(const parseinfo *pai, int cbyte,
   adns_rr_soa *rrp= datap;
   const byte *dgram= pai->dgram;
   adns_status st;
-  int msw, lsw, i;
+  int i;
 
   st= pap_domain(pai, &cbyte, max, &rrp->mname,
                 pai->qu->flags & adns_qf_quoteok_anshost ? pdf_quoteok : 0);
@@ -1383,9 +1383,8 @@ static adns_status pa_soa(const parseinfo *pai, int cbyte,
   if (cbyte+20 != max) return adns_s_invaliddata;
   
   for (i=0; i<5; i++) {
-    GET_W(cbyte,msw);
-    GET_W(cbyte,lsw);
-    (&rrp->serial)[i]= (msw<<16) | lsw;
+    unsigned long v;
+    (&rrp->serial)[i]= GET_L(cbyte, v);
   }
 
   return adns_s_ok;