From: Derrick Brashear Date: Thu, 14 Nov 2002 20:41:44 +0000 (+0000) Subject: also avoid potential null deref in ih_open but with the ReadVolumeHeader patch X-Git-Tag: openafs-stable-1_2_8~51 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=96f04c49f0f1b8e9edb47a578bc2740ec5012fdf;p=packages%2Fo%2Fopenafs.git also avoid potential null deref in ih_open but with the ReadVolumeHeader patch we should never get there. thanks to Kris Van Hees for discovering this (cherry picked from commit c6da165252c61a2328837d13c4463026d47a45c0) --- diff --git a/src/vol/ihandle.c b/src/vol/ihandle.c index ca5a54808..e8f8c15ab 100644 --- a/src/vol/ihandle.c +++ b/src/vol/ihandle.c @@ -257,6 +257,9 @@ FdHandle_t *ih_open(IHandle_t *ihP) FD_t fd; FD_t closeFd; + if (!ihP) /* XXX should log here in the fileserver */ + return NULL; + IH_LOCK /* Do we already have an open file handle for this Inode? */ diff --git a/src/vol/volume.c b/src/vol/volume.c index c2afa3e4e..889d9eac9 100644 --- a/src/vol/volume.c +++ b/src/vol/volume.c @@ -388,6 +388,11 @@ static void ReadHeader(Error *ec, IHandle_t *h, char *to, int size, FdHandle_t *fdP; *ec = 0; + if (h == NULL) { + *ec = VSALVAGE; + return; + } + fdP = IH_OPEN(h); if (fdP == NULL) { *ec = VSALVAGE;