Commit d0c1927
committed
expand_buf: Allocate "newsize" bytes not "needed" bytes
Sync the implementation of expand_buf() with the version in
logsrv_util.c. We compute "newsize" by rounding up the number of
needed bytes to the nearest power of 2, but the malloc() call used
the unrounded size. This is only used for messages coming from
sudo_logsrvd, which are not going to be larger than the initial
buffer, so there is no possibility of an overflow.
Thanks to Joshua Rogers for finding this.1 parent 7fe2dd2 commit d0c1927
1 file changed
+6
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
1671 | 1671 | | |
1672 | 1672 | | |
1673 | 1673 | | |
| 1674 | + | |
| 1675 | + | |
1674 | 1676 | | |
1675 | 1677 | | |
1676 | 1678 | | |
1677 | 1679 | | |
1678 | 1680 | | |
1679 | | - | |
| 1681 | + | |
1680 | 1682 | | |
1681 | | - | |
| 1683 | + | |
1682 | 1684 | | |
1683 | 1685 | | |
1684 | 1686 | | |
1685 | 1687 | | |
1686 | 1688 | | |
1687 | 1689 | | |
1688 | | - | |
| 1690 | + | |
1689 | 1691 | | |
1690 | 1692 | | |
1691 | 1693 | | |
| |||
0 commit comments