Commit 5f4d71e
committed
Merge rust-bitcoin#4649: fix: preserve embedded nulls in
a6f63cf fix: validate ASCII and preserve embedded nulls in CommandString parsing (Erick Cestari)
Pull request description:
Previously, `CommandString` decoding would silently normalize invalid commands containing embedded null bytes. For example, "mem\0pool" would be incorrectly decoded as "mempool", bypassing consensus validation.
Found through differential fuzzing between btcd and rust-bitcoin, where rust-bitcoin was accepting messages with embedded null bytes in Command fields while btcd (and Bitcoin Core) correctly reject them.
ACKs for top commit:
apoelstra:
ACK a6f63cf; successfully ran local tests
tcharding:
ACK a6f63cf
Tree-SHA512: fccf7fc29fb3eac8ca0e3dd2e18d7fadbfdce913448d5e05f3b0c1e545993952a70680fc652acf6e5b7a4bc8b1b053622081f9af733e45d7c51ab47bc8675a1dCommandString for consensus validation1 file changed
+22
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
| |||
892 | 893 | | |
893 | 894 | | |
894 | 895 | | |
895 | | - | |
896 | | - | |
897 | | - | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
898 | 908 | | |
899 | 909 | | |
900 | 910 | | |
| |||
0 commit comments