Fix possible access to uninitialized values.
This commit is contained in:
parent
8d0c20c0f4
commit
34966a35b5
2 changed files with 33 additions and 3 deletions
|
@ -59,7 +59,7 @@
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@implementation XMPPConnection
|
@implementation XMPPConnection
|
||||||
@synthesize username, password, server, resource, JID, port, useTLS, delegate;
|
@synthesize JID, port, useTLS, delegate;
|
||||||
|
|
||||||
- init
|
- init
|
||||||
{
|
{
|
||||||
|
@ -110,6 +110,11 @@
|
||||||
[old release];
|
[old release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OFString*)username
|
||||||
|
{
|
||||||
|
return [[username copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setResource: (OFString*)resource_
|
- (void)setResource: (OFString*)resource_
|
||||||
{
|
{
|
||||||
OFString *old = resource;
|
OFString *old = resource;
|
||||||
|
@ -133,6 +138,11 @@
|
||||||
[old release];
|
[old release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OFString*)resource
|
||||||
|
{
|
||||||
|
return [[resource copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setServer: (OFString*)server_
|
- (void)setServer: (OFString*)server_
|
||||||
{
|
{
|
||||||
OFString *old = server;
|
OFString *old = server;
|
||||||
|
@ -156,6 +166,11 @@
|
||||||
[old release];
|
[old release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OFString*)server
|
||||||
|
{
|
||||||
|
return [[server copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)setPassword: (OFString*)password_
|
- (void)setPassword: (OFString*)password_
|
||||||
{
|
{
|
||||||
OFString *old = password;
|
OFString *old = password;
|
||||||
|
@ -178,6 +193,11 @@
|
||||||
[old release];
|
[old release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OFString*)password
|
||||||
|
{
|
||||||
|
return [[password copy] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)connect
|
- (void)connect
|
||||||
{
|
{
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||||
|
|
|
@ -172,6 +172,9 @@ extern uint32_t arc4random_uniform(uint32_t);
|
||||||
OFDataArray *ret, *authMessage, *tmpArray, *salt, *saltedPassword;
|
OFDataArray *ret, *authMessage, *tmpArray, *salt, *saltedPassword;
|
||||||
OFString *tmpString, *sNonce;
|
OFString *tmpString, *sNonce;
|
||||||
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
|
||||||
|
enum {
|
||||||
|
GOT_SNONCE, GOT_SALT, GOT_ITERCOUNT
|
||||||
|
} got = 0;
|
||||||
|
|
||||||
hash = [[[hashType alloc] init] autorelease];
|
hash = [[[hashType alloc] init] autorelease];
|
||||||
ret = [OFDataArray dataArrayWithItemSize: 1];
|
ret = [OFDataArray dataArrayWithItemSize: 1];
|
||||||
|
@ -193,12 +196,19 @@ extern uint32_t arc4random_uniform(uint32_t);
|
||||||
reason: @"Received wrong nonce"];
|
reason: @"Received wrong nonce"];
|
||||||
|
|
||||||
sNonce = entry;
|
sNonce = entry;
|
||||||
} else if ([comp hasPrefix: @"s="])
|
got |= GOT_SNONCE;
|
||||||
|
} else if ([comp hasPrefix: @"s="]) {
|
||||||
salt = [OFDataArray
|
salt = [OFDataArray
|
||||||
dataArrayWithBase64EncodedString: entry];
|
dataArrayWithBase64EncodedString: entry];
|
||||||
else if ([comp hasPrefix: @"i="])
|
got |= GOT_SALT;
|
||||||
|
} else if ([comp hasPrefix: @"i="]) {
|
||||||
iterCount = [entry decimalValue];
|
iterCount = [entry decimalValue];
|
||||||
|
got |= GOT_ITERCOUNT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (got != (GOT_SNONCE | GOT_SALT | GOT_ITERCOUNT))
|
||||||
|
@throw [OFInvalidServerReplyException newWithClass: isa];
|
||||||
|
|
||||||
// Add c=<base64(GS2Header+channelBindingData)>
|
// Add c=<base64(GS2Header+channelBindingData)>
|
||||||
// XXX: No channel binding for now
|
// XXX: No channel binding for now
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue