From 60ecc3d68b188766e53dd314b40a0eb1192425ae Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 29 Mar 2012 15:01:18 +0000 Subject: [PATCH] * sec_acl.cc (acl32): Fix potnetial crash if build_fh_name returns NULL. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/sec_acl.cc | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 4aa1a005c..47001a029 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2012-03-29 Corinna Vinschen + + * sec_acl.cc (acl32): Fix potnetial crash if build_fh_name returns NULL. + 2012-03-29 Christopher Faylor * exceptions.cc (ctrl_c_handler): Don't generate a SIGINT if we've diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index b2fd3f4d7..14cb88667 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -1,7 +1,7 @@ /* sec_acl.cc: Sun compatible ACL functions. Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 Red Hat, Inc. + 2009, 2010, 2011, 2012 Red Hat, Inc. Written by Corinna Vinschen @@ -451,13 +451,13 @@ acl32 (const char *path, int cmd, int nentries, __aclent32_t *aclbufp) fhandler_base *fh = build_fh_name (path, PC_SYM_FOLLOW | PC_KEEP_HANDLE, stat_suffixes); - if (fh->error ()) + if (!fh || !fh->exists ()) + set_errno (ENOENT); + else if (fh->error ()) { debug_printf ("got %d error from build_fh_name", fh->error ()); set_errno (fh->error ()); } - else if (!fh->exists ()) - set_errno (ENOENT); else res = fh->facl (cmd, nentries, aclbufp);