... | ... |
@@ -803,6 +803,12 @@ uint16_t cli_bcomp_chk_hex(const unsigned char* buffer, uint16_t opt, uint32_t l |
803 | 803 |
uint16_t check = 0; |
804 | 804 |
|
805 | 805 |
if (!buffer || len < 3) { |
806 |
+ if (buffer && len < 3) { |
|
807 |
+ if ((opt & 0x00F0) & CLI_BCOMP_AUTO) { |
|
808 |
+ opt |= CLI_BCOMP_DEC; |
|
809 |
+ opt ^= CLI_BCOMP_AUTO; |
|
810 |
+ } |
|
811 |
+ } |
|
806 | 812 |
return check_only ? check : opt; |
807 | 813 |
} |
808 | 814 |
|
... | ... |
@@ -924,6 +930,8 @@ unsigned char* cli_bcomp_normalize_buffer(const unsigned char* buffer, uint32_t |
924 | 924 |
/* non-hex detected, our current buffer is invalid so zero it out and continue */ |
925 | 925 |
memset(tmp_buffer, '0', norm_len+1); |
926 | 926 |
hex = 0; |
927 |
+ /* nibbles after this are non-good, so skip them */ |
|
928 |
+ continue; |
|
927 | 929 |
} |
928 | 930 |
} |
929 | 931 |
|