From f853e73acf39658125ce42861e49ce4a181611d3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 5 Jan 2021 18:01:26 -0800 Subject: Replace ND_TCHECK_/memcpy() pairs with GET_CPY_BYTES(). For BGP, this eliminates some cases where routines return -1 on truncation; clean up after that. This also means that some memcpy()s get replaced by UNALIGNED_MEMCPY(), which may fix some issues on processors that don't support unaligned accesses. --- print-domain.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'print-domain.c') diff --git a/print-domain.c b/print-domain.c index 74c71dba..c3c6fd8f 100644 --- a/print-domain.c +++ b/print-domain.c @@ -796,10 +796,8 @@ ns_rprint(netdissect_options *ndo, ND_PRINT(" %u(bad plen)", pbit); break; } else if (pbit < 128) { - if (!ND_TTEST_LEN(cp + 1, sizeof(a) - pbyte)) - return(NULL); memset(a, 0, sizeof(a)); - memcpy(a + pbyte, cp + 1, sizeof(a) - pbyte); + GET_CPY_BYTES(a + pbyte, cp + 1, sizeof(a) - pbyte); ND_PRINT(" %u %s", pbit, addrtostr6(&a, ntop_buf, sizeof(ntop_buf))); } -- cgit v1.2.1