This series fixes two latent crash bugs in pfinet where mmap
return values go unchecked, may causing crash when memory is tight.
Both bugs follow the same pattern: mmap is called to grow a buffer,
but the returned pointer is dereferenced before (or without) checking
for MAP_FAILED. Under normal operation mmap rarely fails, so these
have gone unnoticed, but under address-space pressure pfinet would
crash.
Patch 1 fixes S_pfinet_siocgifconf
Patch 2 fixes S_pfinet_getroutes
Changes in v4:
- Fix indentation issues according to the project style
- Patch 1/2, 2/2: no functional changes from v2
Changes in v3:
- Add patch 3/3: indentation cleanup (raised by maintainer)
- Patch 1/3, 2/3: no functional changes from v2
Changes in v2:
- Added comment explaining why ENOMEM is used instead of errno,
as glue headers #undef errno.
Sophiel Zhou (2):
pfinet: add MAP_FAILED check after mmap in S_pfinet_siocgifconf
pfinet: check MAP_FAILED immediately after mmap in S_pfinet_getroutes
pfinet/pfinet-ops.c | 33 +++++++++++++++++++--------------
1 file changed, 19 insertions(+), 14 deletions(-)
--
2.54.0