summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernie Innocenti <codewiz@google.com>2018-04-02 09:55:51 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-04-02 09:55:51 +0000
commit7207d62da8bc097d333bd58edc4100ef58933368 (patch)
tree5b38fa42763cba13b6963b504e4fb5a820b63f2c
parent7a1d9a6dbddaa46e8b74859952a58b55ddcd5801 (diff)
parent7024456a1fb07f0a88ed8dbeeba41c21a4a40304 (diff)
downloadapf-o-mr1-iot-preview-8.tar.gz
Merge "apf: Fix bound-checking to allow accessing the last data byte."android-o-mr1-iot-preview-8o-mr1-iot-preview-8
-rw-r--r--apf_interpreter.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/apf_interpreter.c b/apf_interpreter.c
index f5e0072..e2f46cb 100644
--- a/apf_interpreter.c
+++ b/apf_interpreter.c
@@ -42,7 +42,7 @@ int accept_packet(const uint8_t* program, uint32_t program_len,
// Is access to offset |p| length |size| within data bounds?
#define IN_DATA_BOUNDS(p, size) (ENFORCE_UNSIGNED(p) && \
ENFORCE_UNSIGNED(size) && \
- (p) + (size) < data_len && \
+ (p) + (size) <= data_len && \
(p) + (size) >= (p)) // catch wraparounds
// Accept packet if not within program bounds
#define ASSERT_IN_PROGRAM_BOUNDS(p) ASSERT_RETURN(IN_PROGRAM_BOUNDS(p))