Fix possible access to uninitialized values.

This commit is contained in:
Jonathan Schleifer 2011-03-21 19:01:52 +01:00
parent 8d0c20c0f4
commit 34966a35b5
2 changed files with 33 additions and 3 deletions

View file

@ -172,6 +172,9 @@ extern uint32_t arc4random_uniform(uint32_t);
OFDataArray *ret, *authMessage, *tmpArray, *salt, *saltedPassword;
OFString *tmpString, *sNonce;
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
enum {
GOT_SNONCE, GOT_SALT, GOT_ITERCOUNT
} got = 0;
hash = [[[hashType alloc] init] autorelease];
ret = [OFDataArray dataArrayWithItemSize: 1];
@ -193,13 +196,20 @@ extern uint32_t arc4random_uniform(uint32_t);
reason: @"Received wrong nonce"];
sNonce = entry;
} else if ([comp hasPrefix: @"s="])
got |= GOT_SNONCE;
} else if ([comp hasPrefix: @"s="]) {
salt = [OFDataArray
dataArrayWithBase64EncodedString: entry];
else if ([comp hasPrefix: @"i="])
got |= GOT_SALT;
} else if ([comp hasPrefix: @"i="]) {
iterCount = [entry decimalValue];
got |= GOT_ITERCOUNT;
}
}
if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
@throw [OFInvalidServerReplyException newWithClass: isa];
// Add c=<base64(GS2Header+channelBindingData)>
// XXX: No channel binding for now
tmpArray = [OFDataArray dataArrayWithItemSize: 1];