Repository navigation
Commit 81c09eb
committed
libaudit: enforce kernel comm length limit
audit_log_user_comm_message accepted arbitrary-length comm strings even though comm represents /proc/self/comm and Linux TASK_COMM_LEN permits at most 15 content bytes plus the terminating NUL. Encoding an overlong value could therefore exceed the caller's stack buffer.
Bound command-name inspection to the kernel limit, reject malformed caller values with EINVAL, and size the procfs and encoded-output buffers from that limit. Document the comm contract and the new validation error.
Add a regression that submits an encoded 16-byte command name and verifies it is rejected with EINVAL. The exact 15-byte accepted and 16-byte rejected boundaries were also validated with AddressSanitizer.1 parent 9b6c174 commit 81c09eb
3 files changed
Lines changed: 53 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
32 | 38 | | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
39 | 50 | | |
40 | 51 | | |
41 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
197 | 200 | | |
198 | 201 | | |
199 | 202 | | |
200 | | - | |
201 | | - | |
| 203 | + | |
202 | 204 | | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
203 | 209 | | |
204 | 210 | | |
205 | 211 | | |
206 | | - | |
207 | | - | |
| 212 | + | |
| 213 | + | |
208 | 214 | | |
209 | 215 | | |
210 | 216 | | |
| |||
223 | 229 | | |
224 | 230 | | |
225 | 231 | | |
226 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
227 | 237 | | |
228 | 238 | | |
229 | 239 | | |
| |||
367 | 377 | | |
368 | 378 | | |
369 | 379 | | |
370 | | - | |
| 380 | + | |
371 | 381 | | |
372 | 382 | | |
373 | 383 | | |
| |||
382 | 392 | | |
383 | 393 | | |
384 | 394 | | |
385 | | - | |
| 395 | + | |
386 | 396 | | |
387 | 397 | | |
388 | 398 | | |
| |||
416 | 426 | | |
417 | 427 | | |
418 | 428 | | |
419 | | - | |
| 429 | + | |
| 430 | + | |
420 | 431 | | |
421 | 432 | | |
422 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
481 | 481 | | |
482 | 482 | | |
483 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
484 | 505 | | |
485 | 506 | | |
486 | 507 | | |
| |||
515 | 536 | | |
516 | 537 | | |
517 | 538 | | |
| 539 | + | |
518 | 540 | | |
519 | 541 | | |
0 commit comments