Commit c3b0042
committed
Fix some static analysis findings
struct audit_message embeds a netlink header followed by a fixed-size payload buffer, so copying more than sizeof(req.data) bytes into the stack object will clobber adjacent state.
The updated sender now rejects requests whose payload exceeds that buffer and makes sure the padded wire size stays within the kernel’s maximum before copying the user data into the in-struct array, eliminating the unchecked write Coverity spotted.
We still populate nlmsg_len with NLMSG_SPACE(size), so the layout expected by the historical macros is preserved while giving the analyzer an obvious bound check.
During a live reconfigure, the new settings structure is torn down once the merge finishes. If we simply assigned oconf->plugin_dir = nconf->plugin_dir, the old configuration would wind up pointing at memory that destroy_config(nconf) later frees, which is exactly what Coverity warned about. The revised code duplicates any new path into storage owned by the running configuration, frees the superseded value, and clears whichever pointer the temporary configuration no longer owns so the final cleanup cannot free it twice.
That removes the aliasing path Coverity described.
Bad-login reporting used to stuff whatever pointer auparse returned into a temporary stack lnode and then pass it to report_session, which blindly printed term+5 when the name started with /dev/. If term was the short literal "?", advancing five bytes ran off the end of the two-byte buffer Coverity modeled. The new logic normalizes the pointer before printing—falling back to "?" when the field is missing and only skipping the /dev/ prefix when the string is actually long enough—so nothing dereferences past the available characters.1 parent b83c84e commit c3b0042
3 files changed
+39
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
203 | 208 | | |
204 | 209 | | |
205 | 210 | | |
| |||
217 | 222 | | |
218 | 223 | | |
219 | 224 | | |
220 | | - | |
| 225 | + | |
221 | 226 | | |
222 | 227 | | |
223 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1574 | 1574 | | |
1575 | 1575 | | |
1576 | 1576 | | |
1577 | | - | |
1578 | | - | |
1579 | | - | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
1580 | 1592 | | |
1581 | | - | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
1582 | 1600 | | |
1583 | 1601 | | |
1584 | 1602 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
78 | 85 | | |
79 | 86 | | |
80 | 87 | | |
| |||
0 commit comments