diff options
| author | khedor <khedor@gmail.com> | 2026-05-22 20:15:10 +0300 |
|---|---|---|
| committer | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-05-23 11:41:36 +0300 |
| commit | a68821aecb2fecfc7c35fd5d49867f202d64df7f (patch) | |
| tree | 9e0b6e096e4cb4650f826de036c2b146ab76ea60 /tests/common/pppd_process.py | |
| parent | 4823556fbbadcd5205175d423ebca627dc317843 (diff) | |
| download | accel-ppp-a68821aecb2fecfc7c35fd5d49867f202d64df7f.tar.gz accel-ppp-a68821aecb2fecfc7c35fd5d49867f202d64df7f.zip | |
pppoe/disc: fix free_net memmove count and overlap handling
free_net() compacts the nets[] array by sliding entries left after
removing one:
memcpy(nets + i, nets + i + 1, net_cnt - i - 1);
Two bugs:
1. The count is a raw element count, not a byte count. nets[] holds
'struct disc_net *' pointers, so only (net_cnt - i - 1) bytes are
moved instead of (net_cnt - i - 1) * sizeof(nets[0]). On the usual
8-byte-pointer build, 7 of every 8 surviving pointers are lost,
leaving uninitialised holes in the array.
2. Source and destination overlap (nets + i and nets + i + 1), so
memcpy is undefined behaviour. The correct primitive is memmove.
Switch to memmove and multiply the count by sizeof(nets[0]).
Signed-off-by: khedor <khedor@gmail.com>
Diffstat (limited to 'tests/common/pppd_process.py')
0 files changed, 0 insertions, 0 deletions
