Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid using uninitialized data from G_io_apdu_buffer #6

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix the out-of-bounds check to avoid UB
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
commit 08ed3941a3166e42a6332dece09c7c991dcdbb89
4 changes: 2 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -93,9 +93,9 @@ txn_deny()
}

static void
copy_and_advance(void *dst, uint8_t **p, uint8_t *pend, size_t len)
copy_and_advance(void *dst, uint8_t **p, uint8_t *pend, int len)
{
if (*p + len > pend) {
if (pend - *p < len) {
THROW(0x6700);
}