Commit 077d435
improve error handling in webRTC-related noise function (paritytech#377)
Closes paritytech#43 This PR:
- [x] eliminates the unsafe assumption and panics in the WebRTC litep2p
config when fetching `Multiaddr`. Ensures litep2p behaves predictably
even with malformed or malicious peers during the handshake phase by
introducing `InvalidMultihash` in the `AddressError`.
- [x] removes assumption about the `reply` buffer size, by checking the
length before splitting in `get_remote_public_key` function.
I am also looking at other functions to see if there should be any
improvement, i will make this a draft PR untill i finish other
improvements or if i find no other improvements needed.
---------
Co-authored-by: Dmitry Markin <[email protected]>1 parent a950f7a commit 077d435
3 files changed
+13
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
62 | | - | |
63 | | - | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
| 64 | + | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
| |||
332 | 330 | | |
333 | 331 | | |
334 | 332 | | |
335 | | - | |
336 | | - | |
337 | | - | |
| 333 | + | |
338 | 334 | | |
339 | 335 | | |
340 | 336 | | |
| |||
349 | 345 | | |
350 | 346 | | |
351 | 347 | | |
352 | | - | |
353 | | - | |
354 | | - | |
| 348 | + | |
355 | 349 | | |
356 | 350 | | |
357 | 351 | | |
| |||
366 | 360 | | |
367 | 361 | | |
368 | 362 | | |
369 | | - | |
370 | | - | |
371 | | - | |
| 363 | + | |
372 | 364 | | |
373 | 365 | | |
374 | 366 | | |
| |||
383 | 375 | | |
384 | 376 | | |
385 | 377 | | |
386 | | - | |
387 | | - | |
388 | | - | |
| 378 | + | |
389 | 379 | | |
390 | 380 | | |
391 | 381 | | |
| |||
0 commit comments