Bug 74904

Summary: In function p11_mmap_open, wrong comparison of mmap return value (Unix)
Product: p11-glue Reporter: Gilles Mouchard <gilles.mouchard>
Component: p11-kitAssignee: Stef Walter <stefw>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: A patch against version p11-kit 0.20.2 (untested)

Description Gilles Mouchard 2014-02-12 20:42:40 UTC
Created attachment 93961 [details]
A patch against version p11-kit 0.20.2 (untested)

Hello,

I think that, in function p11_mmap_open, in file common/compat.c, at line #220, the comparison of mmap return value is wrong.
The return value must be compared to MAP_FAILED (i.e. (void *) -1) instead of NULL.
This can lead to bad munmap later in p11_mmap_close, for example while parsing an empty /etc/pkcs11/pkcs11.conf file with function _p11_conf_parse_file.
Comment 1 Gilles Mouchard 2014-02-12 21:17:08 UTC

*** This bug has been marked as a duplicate of bug 74773 ***

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.