From bee9b6b32149106bbde2d574edf7b629696f15e8 Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Thu, 7 Oct 2010 15:38:51 +0000 Subject: [PATCH] chmod_extended and fchmod_extended: handle NULL xsecurity argument correctly. Fixes #247510. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11412 --- coregrind/m_syswrap/syswrap-darwin.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/coregrind/m_syswrap/syswrap-darwin.c b/coregrind/m_syswrap/syswrap-darwin.c index 2a929c1bb..76ad8674d 100644 --- a/coregrind/m_syswrap/syswrap-darwin.c +++ b/coregrind/m_syswrap/syswrap-darwin.c @@ -2041,8 +2041,10 @@ PRE(fchmod_extended) /* DDD: relative to the xnu sources (kauth_copyinfilesec), this is just way wrong. [The trouble is with the size, which depends on a non-trival kernel computation] */ - PRE_MEM_READ( "fchmod_extended(xsecurity)", ARG5, - sizeof(struct vki_kauth_filesec) ); + if (ARG5) { + PRE_MEM_READ( "fchmod_extended(xsecurity)", ARG5, + sizeof(struct vki_kauth_filesec) ); + } } PRE(chmod_extended) @@ -2061,8 +2063,10 @@ PRE(chmod_extended) /* DDD: relative to the xnu sources (kauth_copyinfilesec), this is just way wrong. [The trouble is with the size, which depends on a non-trival kernel computation] */ - PRE_MEM_READ( "chmod_extended(xsecurity)", ARG5, - sizeof(struct vki_kauth_filesec) ); + if (ARG5) { + PRE_MEM_READ( "chmod_extended(xsecurity)", ARG5, + sizeof(struct vki_kauth_filesec) ); + } } PRE(open_extended)