Skip to content

Commit

Permalink
prevents an overflowing subtraction when using JLink
Browse files Browse the repository at this point in the history
  • Loading branch information
benbrittain committed Apr 3, 2022
1 parent 22c2b83 commit ed12148
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion humility-core/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,9 @@ impl GDBCore {
// We are done when we have our closing delimter followed by
// the two byte checksum.
//
if result.find(GDB_PACKET_END) == Some(result.len() - 3) {
if result.len() >= 3
&& result.find(GDB_PACKET_END) == Some(result.len() - 3)
{
break;
}
}
Expand Down

0 comments on commit ed12148

Please sign in to comment.