diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-03-06 09:23:32 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-03-06 17:24:05 +0000 |
commit | ad3afb02c369323d83df0cd38fc790203adfd889 (patch) | |
tree | 01f5243167eb47f9c27b6a1077562c8660d25948 /editcap.c | |
parent | 5876dc241cf15d9b9faedacb63e4f887867ba530 (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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |