aboutsummaryrefslogtreecommitdiffstats
path: root/editcap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2016-03-06 09:23:32 -0800
committerGuy Harris <guy@alum.mit.edu>2016-03-06 17:24:05 +0000
commitad3afb02c369323d83df0cd38fc790203adfd889 (patch)
tree01f5243167eb47f9c27b6a1077562c8660d25948 /editcap.c
parent5876dc241cf15d9b9faedacb63e4f887867ba530 (diff)
Properly fetch the ethertype.
The ethertype is 16 bits and big-endian, so fetch it with pntoh16() to convert it to host byte order (and to handle unaligned values). Fixes Coverity CID 1355352. Change-Id: I14980e2813c3ea19c6df01681f8ed7aaad5c3f59 Reviewed-on: https://code.wireshark.org/review/14359 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'editcap.c')
-rw-r--r--editcap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/editcap.c b/editcap.c
index d6c2392c56..cc12f75fbc 100644
--- a/editcap.c
+++ b/editcap.c
@@ -89,6 +89,7 @@
#include <wsutil/str_util.h>
#include <wsutil/ws_diag_control.h>
#include <wsutil/ws_version_info.h>
+#include <wsutil/pint.h>
#include <wiretap/wtap_opttypes.h>
#include <wiretap/pcapng.h>
@@ -554,7 +555,7 @@ set_rel_time(char *optarg_str_p)
#define VLAN_SIZE 4
static void
sll_remove_vlan_info(guint8* fd, guint32* len) {
- if (g_ntohs(*(fd + LINUX_SLL_OFFSETP)) == ETHERTYPE_VLAN) {
+ if (pntoh16(fd + LINUX_SLL_OFFSETP) == ETHERTYPE_VLAN) {
int rest_len;
/* point to start of vlan */
fd = fd + LINUX_SLL_OFFSETP;