Commit 1fd0e93
committed
fix(cluster): make join-token tamper test robust against zero MAC bytes
The tamper tests in both nodedb-cluster and nodedb-ctl replaced the last
hex byte of the MAC with the literal "00". When the real MAC byte
happened to already be 0x00 — which occurs ~1/256 of the time — the
replacement was a no-op and the test incorrectly passed a token with an
unmodified MAC to verify_token, causing the assertion to fail.
Replace the fixed "00" substitution with XOR 0xFF, which guarantees the
byte always changes regardless of its original value.1 parent 1128235 commit 1fd0e93
2 files changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | | - | |
| 183 | + | |
| 184 | + | |
182 | 185 | | |
183 | 186 | | |
184 | 187 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
86 | 89 | | |
87 | 90 | | |
88 | | - | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
| |||
0 commit comments