Skip to content

Commit be2437d

Browse files
author
Jamie C. Driver
committed
esp32-build: robustness - ignore codeword payload with bad length word
1 parent c3abc15 commit be2437d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/bytewords.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ static const int16_t _lookup[] = {
6464
};
6565

6666
static bool decode_word(const string& word, size_t word_len, uint8_t& output) {
67-
assert(word.length() == word_len);
6867
const size_t dim = 26;
6968

69+
// Sanity check
70+
if(word.length() != word_len) {
71+
return false;
72+
}
73+
7074
// If the coordinates generated by the first and last letters are out of bounds,
7175
// or the lookup table contains -1 at the coordinates, then the word is not valid.
7276
int x = tolower(word[0]) - 'a';

0 commit comments

Comments
 (0)