summaryrefslogtreecommitdiff
path: root/source/Utility/StringExtractor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Utility/StringExtractor.cpp')
-rw-r--r--source/Utility/StringExtractor.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/source/Utility/StringExtractor.cpp b/source/Utility/StringExtractor.cpp
index d4ce470d56f3..9d2315708821 100644
--- a/source/Utility/StringExtractor.cpp
+++ b/source/Utility/StringExtractor.cpp
@@ -145,11 +145,10 @@ StringExtractor::GetChar (char fail_value)
uint8_t
StringExtractor::GetHexU8 (uint8_t fail_value, bool set_eof_on_fail)
{
- uint32_t i = m_index;
- if ((i + 2) <= m_packet.size())
+ if (GetBytesLeft() >= 2)
{
- const uint8_t hi_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[i])];
- const uint8_t lo_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[i+1])];
+ const uint8_t hi_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[m_index])];
+ const uint8_t lo_nibble = g_hex_ascii_to_hex_integer[static_cast<uint8_t>(m_packet[m_index+1])];
if (hi_nibble < 16 && lo_nibble < 16)
{
m_index += 2;