Menu

#159 Fix null deref crash in MAPI GetNamesFromIDs()

Unstable (example)
closed-fixed
nobody
None
5
2016-02-27
2016-01-22
No

It is possible for the SPropTagArray to not be initialized during the GetNamesFromIDs() call which causes a crash when passed to PyMAPIObject_FromSPropTagArray(). This patch tests for null, and uses PyTuple_New(0) in its place.

1 Attachments

Discussion

  • Mark Hammond

    Mark Hammond - 2016-02-27
    • status: open --> closed-fixed
     
  • Mark Hammond

    Mark Hammond - 2016-02-27

    Thanks - but I decided to fix this directly in PyMAPIObject_FromSPropTagArray (so all other callers of this don't crash in similar ways) but I changed it to return None instead of an empty tuple (there may be a case where the caller cares about the distinction between null and an empty array. Let me know if this causes you any problems.

    Revision 4382:8c70bcb663b9

     
  • Nick Czeczulin

    Nick Czeczulin - 2016-02-27

    Regarding using None instead of an empty tuple, I believe your change is the correct choice. I cannot seem to find anything in the msdn documentation that documents this behavior for an invalid PropSetGuid. At least not explicitly in the various result scenarios documented. So it's probably best not to mask it as you pointed out.

     

Log in to post a comment.