Skip to content

Commit 198537a

Browse files
committed
Require "vpi" and "vci" values to be within valid ranges.
libpcap implements UNI ATM encoding, which has 8-bit VPI and 16-bit VCI.
1 parent 0535957 commit 198537a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ DayOfTheWeek, Month DD, YYYY / The Tcpdump Group
4343
request #1273).
4444
Eliminate trailing space in bpf_image() result.
4545
Fix DECnet packet filtering on big-endian hosts.
46+
Require "vpi" and "vci" values to be within valid ranges.
4647
rpcap:
4748
Support user names and passwords in rpcap:// and rpcaps:// URLs.
4849
Add a -t flag to rpcapd to specify the data channel port; from

gencode.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <setjmp.h>
3434
#include <stdarg.h>
3535
#include <stdio.h>
36+
#include <stdint.h>
3637

3738
#include "pcap-int.h"
3839

@@ -10148,6 +10149,8 @@ gen_atmfield_code_internal(compiler_state_t *cstate, int atmfield,
1014810149
bpf_error(cstate, "'vpi' supported only on raw ATM");
1014910150
if (cstate->off_vpi == OFFSET_NOT_SET)
1015010151
abort();
10152+
if (jvalue > UINT8_MAX)
10153+
bpf_error(cstate, "VPI value %u > %u", jvalue, UINT8_MAX);
1015110154
b0 = gen_ncmp(cstate, OR_LINKHDR, cstate->off_vpi, BPF_B,
1015210155
0xffffffffU, jtype, reverse, jvalue);
1015310156
break;
@@ -10157,6 +10160,8 @@ gen_atmfield_code_internal(compiler_state_t *cstate, int atmfield,
1015710160
bpf_error(cstate, "'vci' supported only on raw ATM");
1015810161
if (cstate->off_vci == OFFSET_NOT_SET)
1015910162
abort();
10163+
if (jvalue > UINT16_MAX)
10164+
bpf_error(cstate, "VCI value %u > %u", jvalue, UINT16_MAX);
1016010165
b0 = gen_ncmp(cstate, OR_LINKHDR, cstate->off_vci, BPF_H,
1016110166
0xffffffffU, jtype, reverse, jvalue);
1016210167
break;

0 commit comments

Comments
 (0)