Repository navigation
Commit 32fc4dc
ext/standard: dns_get_mx() parses MX exchange past the record RDATA
dns_get_mx() expanded the MX exchange with dn_expand() bounded by the end
of the whole message, not the end of the record's RDATA. An exchange name
with no terminating label ran on into the next record, so its owner name
ended up in $hosts. The fixed RR header and the preference were also read
without checking that they fit in the reply.
The exchange is now expanded up to the end of the RDATA, and the header,
RDLENGTH and preference are checked against the reply length. A malformed
MX record makes dns_get_mx() return false, the same as when dn_expand()
already failed. Tested in a debian container against the crafted UDP
server from the issue; a well-formed reply with compressed exchange names
still returns the same result. No .phpt, since the BIND-based tests in
ext/standard/tests/dns cannot serve a malformed record.
Fix GH-25954
Close GH-259861 parent 039350b commit 32fc4dc
4 files changed
Lines changed: 40 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | | - | |
| 1064 | + | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| |||
1126 | 1126 | | |
1127 | 1127 | | |
1128 | 1128 | | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
1129 | 1133 | | |
1130 | 1134 | | |
1131 | 1135 | | |
1132 | 1136 | | |
1133 | 1137 | | |
1134 | 1138 | | |
1135 | 1139 | | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1136 | 1145 | | |
1137 | | - | |
| 1146 | + | |
1138 | 1147 | | |
1139 | 1148 | | |
1140 | 1149 | | |
1141 | | - | |
| 1150 | + | |
1142 | 1151 | | |
1143 | 1152 | | |
1144 | 1153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
16 | 20 | | |
0 commit comments