Skip to content

Commit

Permalink
fix the out-of-bounds check to avoid UB
Browse files Browse the repository at this point in the history
i think this is purely a pedantic change (our actual invocations of
copy_and_advance could never trigger UB), but might as well use the
UB-free code pattern.
  • Loading branch information
zeldovich committed Jan 23, 2020
1 parent 04ed665 commit 2bf2dfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ txn_deny()
static void
copy_and_advance(void *dst, uint8_t **p, uint8_t *pend, size_t len)
{
if (*p + len > pend) {
if (pend - *p < len) {
THROW(0x6700);
}

Expand Down

0 comments on commit 2bf2dfb

Please sign in to comment.