Skip to content

Commit

Permalink
Fix out-of-bounds read in hex_decode
Browse files Browse the repository at this point in the history
The range check is off by 1.
The input letter 'p' makes an out-of-bounds read.
The resulting byte is unpredictable.

Affects the <bytes> argument of the command "vm_debug pmem_cfind".

Since: 7ba3d15
  • Loading branch information
flaviojs committed Mar 12, 2024
1 parent 4084412 commit 1c98f20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int hex_decode(unsigned char *out,const unsigned char *in,int maxlen)
int empty = TRUE;

for(;len < maxlen;) {
if (*in > sizeof(hexval) || hexval[*in] == BAD)
if (*in >= sizeof(hexval) || hexval[*in] == BAD)
break;

if (empty) {
Expand Down

0 comments on commit 1c98f20

Please sign in to comment.