Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/tcpdump/dist Apply commit fb6e5377f392555b8c725...



details:   https://anonhg.NetBSD.org/src/rev/a902e3f15fc3
branches:  trunk
changeset: 337164:a902e3f15fc3
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Apr 04 18:53:51 2015 +0000

description:
Apply commit fb6e5377f392555b8c725f66b8b701f0061a3695:
-Fix/add ND_TCHECK2 tests,
-Fix a buffer overflow,
-Remove a debug printf

diffstat:

 external/bsd/tcpdump/dist/print-rpki-rtr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r ee6f89bbe8cf -r a902e3f15fc3 external/bsd/tcpdump/dist/print-rpki-rtr.c
--- a/external/bsd/tcpdump/dist/print-rpki-rtr.c        Sat Apr 04 18:51:57 2015 +0000
+++ b/external/bsd/tcpdump/dist/print-rpki-rtr.c        Sat Apr 04 18:53:51 2015 +0000
@@ -178,7 +178,7 @@
     pdu_header = (rpki_rtr_pdu *)tptr;
     pdu_type = pdu_header->pdu_type;
     pdu_len = EXTRACT_32BITS(pdu_header->length);
-    ND_TCHECK2(tptr, pdu_len);
+    ND_TCHECK2(*tptr, pdu_len);
     hexdump = FALSE;
 
     ND_PRINT((ndo, "%sRPKI-RTRv%u, %s PDU (%u), length: %u",
@@ -255,6 +255,7 @@
 
            pdu = (rpki_rtr_pdu_error_report *)tptr;
            encapsulated_pdu_length = EXTRACT_32BITS(pdu->encapsulated_pdu_length);
+           ND_TCHECK2(*tptr, encapsulated_pdu_length);
            tlen = pdu_len;
 
            error_code = EXTRACT_16BITS(pdu->pdu_header.u.error_code);
@@ -287,10 +288,10 @@
                tptr += 4;
                tlen -= 4;
            }
-            printf("text_length: %u tlen %u\n", text_length, tlen);
+           ND_TCHECK2(*tptr, text_length);
            if (text_length && (text_length <= tlen )) {
                memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
-               buf[text_length] = '\0';
+               buf[min(sizeof(buf) - 1, text_length)] = '\0';
                ND_PRINT((ndo, "%sError text: %s", indent_string(indent+2), buf));
            }
        }
@@ -337,13 +338,13 @@
        pdu_header = (rpki_rtr_pdu *)tptr;
         pdu_type = pdu_header->pdu_type;
         pdu_len = EXTRACT_32BITS(pdu_header->length);
+       ND_TCHECK2(*tptr, pdu_len);
 
         /* infinite loop check */
         if (!pdu_type || !pdu_len) {
             break;
         }
 
-        ND_TCHECK2(*tptr, pdu_len);
         if (tlen < pdu_len) {
             goto trunc;
         }



Home | Main Index | Thread Index | Old Index