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
Patch 3 fixes inconsistent indentation issues

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 (3):
  pfinet: add MAP_FAILED check after mmap in S_pfinet_siocgifconf
  pfinet: check MAP_FAILED immediately after mmap in S_pfinet_getroutes
  pfinet: fix whitespace in pfinet-ops.c

 pfinet/pfinet-ops.c | 47 +++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 21 deletions(-)

-- 
2.54.0


Reply via email to