Repository navigation
Commit 578a488
committed
gdbusmessage: Fix types of integer arithmetic in message length calculation
This fixes the addition happening with type `uint32_t`, rather than the
expected `gssize`. Because of the narrower type, this could have
resulted in integer overflow for large header lengths, bypassing the
message length check lower down in the function.
This is not exploitable in practice unless communicating peer-to-peer
with a malicious D-Bus peer, as invalid messages like this would be
filtered out by the message bus (such as `dbus-daemon`).
Rework the arithmetic to use checked arithmetic functions into a
`size_t` (largely as suggested by Simon McVittie), and add some unit
tests. Simply doing the arithmetic in the `gssize` domain would not fix
the issue on 32-bit systems.
Based on a report by Koda Reef, albeit reverse engineered as the report
did not contain a proof of concept of the vulnerability.
Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Fixes: #39331 parent 1676bde commit 578a488
2 files changed
Lines changed: 36 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2273 | 2273 | | |
2274 | 2274 | | |
2275 | 2275 | | |
2276 | | - | |
2277 | | - | |
2278 | | - | |
| 2276 | + | |
| 2277 | + | |
2279 | 2278 | | |
2280 | 2279 | | |
2281 | 2280 | | |
2282 | 2281 | | |
2283 | 2282 | | |
2284 | 2283 | | |
2285 | 2284 | | |
2286 | | - | |
2287 | | - | |
2288 | | - | |
2289 | | - | |
2290 | | - | |
2291 | | - | |
| 2285 | + | |
| 2286 | + | |
2292 | 2287 | | |
2293 | 2288 | | |
2294 | 2289 | | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
| 2290 | + | |
| 2291 | + | |
2301 | 2292 | | |
2302 | 2293 | | |
2303 | 2294 | | |
2304 | 2295 | | |
2305 | 2296 | | |
2306 | 2297 | | |
2307 | 2298 | | |
| 2299 | + | |
2308 | 2300 | | |
2309 | 2301 | | |
2310 | | - | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
2311 | 2312 | | |
2312 | 2313 | | |
2313 | 2314 | | |
2314 | 2315 | | |
2315 | 2316 | | |
2316 | | - | |
| 2317 | + | |
2317 | 2318 | | |
2318 | 2319 | | |
2319 | | - | |
| 2320 | + | |
| 2321 | + | |
2320 | 2322 | | |
2321 | 2323 | | |
2322 | 2324 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
188 | 204 | | |
189 | 205 | | |
190 | 206 | | |
| |||
0 commit comments