Code tidying.
authorSimon Kelley <simon@thekelleys.org.uk>
Mon, 1 May 2023 22:06:29 +0000 (23:06 +0100)
committerSimon Kelley <simon@thekelleys.org.uk>
Mon, 1 May 2023 22:06:29 +0000 (23:06 +0100)
src/edns0.c

index 7f7d5d8..800c51f 100644 (file)
@@ -191,16 +191,13 @@ size_t add_pseudoheader(struct dns_header *header, size_t plen, unsigned char *l
       if (!(p = skip_questions(header, plen)) ||
          !(p = skip_section(p, 
                             ntohs(header->ancount) + ntohs(header->nscount) + ntohs(header->arcount), 
-                            header, plen)))
-      {
-       free(buff);
-       return plen;
-      }
-      if (p + 11 > limit)
-      {
-        free(buff);
-        return plen; /* Too big */
-      }
+                            header, plen)) ||
+         p + 11 > limit)
+       {
+         free(buff);
+         return plen; /* bad packet */
+       }
+      
       *p++ = 0; /* empty name */
       PUTSHORT(T_OPT, p);
       PUTSHORT(udp_sz, p); /* max packet length, 512 if not given in EDNS0 header */