Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/external/bsd/libpcap/dist Pull up following revision(s) (...



details:   https://anonhg.NetBSD.org/src/rev/7e6b23aa2e57
branches:  netbsd-8
changeset: 850939:7e6b23aa2e57
user:      snj <snj%NetBSD.org@localhost>
date:      Mon Aug 14 23:56:35 2017 +0000

description:
Pull up following revision(s) (requested by ginsbach in ticket #209):
        external/bsd/libpcap/dist/gencode.c: revision 1.10
PR lib/51952: Brad Harder: Apply upstream ada959c9
[From upstream tcpdump]
 In pcap_compile(), first check whether the pcap_t is activated.
 Before we allocate or otherwise set up anything, check whether the
 pcap_t is activated, and set the error message string and return -1 if
 it's not.
 That way, we don't go through the cleanup code in that code path -
 there's nothing to clean up.
 Fixes the issue in GitHub pull request #552.

diffstat:

 external/bsd/libpcap/dist/gencode.c |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r 20144b24fe8a -r 7e6b23aa2e57 external/bsd/libpcap/dist/gencode.c
--- a/external/bsd/libpcap/dist/gencode.c       Mon Aug 14 23:54:30 2017 +0000
+++ b/external/bsd/libpcap/dist/gencode.c       Mon Aug 14 23:56:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gencode.c,v 1.9 2017/01/24 22:29:28 christos Exp $     */
+/*     $NetBSD: gencode.c,v 1.9.4.1 2017/08/14 23:56:35 snj Exp $      */
 
 /*#define CHASE_CHAIN*/
 /*
@@ -23,7 +23,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: gencode.c,v 1.9 2017/01/24 22:29:28 christos Exp $");
+__RCSID("$NetBSD: gencode.c,v 1.9.4.1 2017/08/14 23:56:35 snj Exp $");
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -669,6 +669,9 @@
 pcap_compile(pcap_t *p, struct bpf_program *program,
             const char *buf, int optimize, bpf_u_int32 mask)
 {
+#ifdef _WIN32
+       static int done = 0;
+#endif
        compiler_state_t cstate;
        const char * volatile xbuf = buf;
        yyscan_t scanner = NULL;
@@ -676,14 +679,6 @@
        u_int len;
        int  rc;
 
-#ifdef _WIN32
-       static int done = 0;
-
-       if (!done)
-               pcap_wsockinit();
-       done = 1;
-#endif
-
        /*
         * If this pcap_t hasn't been activated, it doesn't have a
         * link-layer type, so we can't use it.
@@ -691,9 +686,14 @@
        if (!p->activated) {
                pcap_snprintf(p->errbuf, PCAP_ERRBUF_SIZE,
                    "not-yet-activated pcap_t passed to pcap_compile");
-               rc = -1;
-               goto quit;
+               return  -1;
        }
+
+#ifdef _WIN32
+       if (!done)
+               pcap_wsockinit();
+       done = 1;
+#endif
        initchunks(&cstate);
        cstate.no_optimize = 0;
        cstate.ai = NULL;



Home | Main Index | Thread Index | Old Index