Commit e580b43
fix(dogstatsd): handle non-UTF-8 packets gracefully instead of panicking (#79)
* fix(dogstatsd): handle non-UTF-8 packets gracefully instead of panicking
process_packet() used expect() on std::str::from_utf8(), which would
panic if a client sent malformed (non-UTF-8) bytes over UDP. This
replaces the panic with an error log and early return, dropping the
invalid packet safely. Adds a unit test to verify the behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fmt
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2eb009a commit e580b43
1 file changed
+36
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
498 | | - | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
499 | 509 | | |
500 | 510 | | |
501 | 511 | | |
| |||
940 | 950 | | |
941 | 951 | | |
942 | 952 | | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
943 | 977 | | |
0 commit comments