From: Simon Wilkinson Date: Tue, 12 Feb 2013 12:24:44 +0000 (+0000) Subject: auth: Handle memory errors when parsing key file X-Git-Tag: upstream/1.8.0_pre1^2~1529 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=06ad9d96b0100d35ba61ddd1d1d5bead9067e78d;p=packages%2Fo%2Fopenafs.git auth: Handle memory errors when parsing key file Return an IO error if we run out of memory whilst parsing a key file Caught by clang-analyzer Change-Id: I783a193fe9315f08d76d1be9b1c77089df25fd64 Reviewed-on: http://gerrit.openafs.org/9146 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/auth/keys.c b/src/auth/keys.c index 13bb64761..9bfa67ac3 100644 --- a/src/auth/keys.c +++ b/src/auth/keys.c @@ -365,6 +365,8 @@ _parseOriginalKeyFile(struct afsconf_dir *dir, char *fileName) for(i=0; itype = afsconf_rxkad; key->subType = 0; @@ -473,6 +475,8 @@ _parseExtendedKeyFile(struct afsconf_dir *dir, char *fileName) afs_int32 reclen; key = afsconf_typedKey_blank(); + if (key == NULL) + goto fail; /* The only data version we currently parse has a reclen of 16. * Anything smaller indicates a corrupt key file. Anything more,