Overview
Comment: | Fix possible access to uninitialized values. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6d4ff18032fe4833bb89e2323b71a19d |
User & Date: | js on 2011-03-21 18:01:52 |
Other Links: | manifest | tags |
Context
2011-03-21
| ||
18:27 | Generate unique IDs and free all instance variables on dealloc. check-in: 913f68c8af user: js tags: trunk | |
18:01 | Fix possible access to uninitialized values. check-in: 6d4ff18032 user: js tags: trunk | |
17:49 | Build tests in Xcode project. check-in: 2883ca1e63 user: js tags: trunk | |
Changes
Modified src/XMPPConnection.m from [7f43a53d6d] to [d8ac129794].
︙ | ︙ | |||
55 56 57 58 59 60 61 | - (void)XMPP_handleFeatures: (OFXMLElement*)elem; - (void)XMPP_handleIQ: (XMPPIQ*)iq; - (void)XMPP_handleMessage: (XMPPMessage*)msg; - (void)XMPP_handlePresence: (XMPPPresence*)pres; @end @implementation XMPPConnection | | | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - (void)XMPP_handleFeatures: (OFXMLElement*)elem; - (void)XMPP_handleIQ: (XMPPIQ*)iq; - (void)XMPP_handleMessage: (XMPPMessage*)msg; - (void)XMPP_handlePresence: (XMPPPresence*)pres; @end @implementation XMPPConnection @synthesize JID, port, useTLS, delegate; - init { self = [super init]; sock = [[OFTCPSocket alloc] init]; parser = [[OFXMLParser alloc] init]; |
︙ | ︙ | |||
105 106 107 108 109 110 111 112 113 114 115 116 117 118 | username = [[OFString alloc] initWithCString: node]; } @finally { free(node); } [old release]; } - (void)setResource: (OFString*)resource_ { OFString *old = resource; char *res; Stringprep_rc rc; | > > > > > | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | username = [[OFString alloc] initWithCString: node]; } @finally { free(node); } [old release]; } - (OFString*)username { return [[username copy] autorelease]; } - (void)setResource: (OFString*)resource_ { OFString *old = resource; char *res; Stringprep_rc rc; |
︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | resource = [[OFString alloc] initWithCString: res]; } @finally { free(res); } [old release]; } - (void)setServer: (OFString*)server_ { OFString *old = server; char *srv; Idna_rc rc; | > > > > > | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | resource = [[OFString alloc] initWithCString: res]; } @finally { free(res); } [old release]; } - (OFString*)resource { return [[resource copy] autorelease]; } - (void)setServer: (OFString*)server_ { OFString *old = server; char *srv; Idna_rc rc; |
︙ | ︙ | |||
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | server = [[OFString alloc] initWithCString: srv]; } @finally { free(srv); } [old release]; } - (void)setPassword: (OFString*)password_ { OFString *old = password; char *pass; Stringprep_rc rc; | > > > > > | 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | server = [[OFString alloc] initWithCString: srv]; } @finally { free(srv); } [old release]; } - (OFString*)server { return [[server copy] autorelease]; } - (void)setPassword: (OFString*)password_ { OFString *old = password; char *pass; Stringprep_rc rc; |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | password = [[OFString alloc] initWithCString: pass]; } @finally { free(pass); } [old release]; } - (void)connect { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [sock connectToHost: server onPort: port]; | > > > > > | 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | password = [[OFString alloc] initWithCString: pass]; } @finally { free(pass); } [old release]; } - (OFString*)password { return [[password copy] autorelease]; } - (void)connect { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; [sock connectToHost: server onPort: port]; |
︙ | ︙ |
Modified src/XMPPSCRAMAuth.m from [9ac3fcb8e2] to [0de8efa633].
︙ | ︙ | |||
168 169 170 171 172 173 174 175 176 177 178 179 180 181 | size_t i; uint8_t *clientKey, *serverKey, *clientSignature; intmax_t iterCount; OFHash *hash; OFDataArray *ret, *authMessage, *tmpArray, *salt, *saltedPassword; OFString *tmpString, *sNonce; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; hash = [[[hashType alloc] init] autorelease]; ret = [OFDataArray dataArrayWithItemSize: 1]; authMessage = [OFDataArray dataArrayWithItemSize: 1]; OFString *chal = [OFString stringWithCString: [challenge cArray] length: [challenge count] * | > > > | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 | size_t i; uint8_t *clientKey, *serverKey, *clientSignature; intmax_t iterCount; OFHash *hash; 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]; authMessage = [OFDataArray dataArrayWithItemSize: 1]; OFString *chal = [OFString stringWithCString: [challenge cArray] length: [challenge count] * |
︙ | ︙ | |||
189 190 191 192 193 194 195 | if (![entry hasPrefix: cNonce]) @throw [XMPPAuthFailedException newWithClass: isa connection: nil reason: @"Received wrong nonce"]; sNonce = entry; | > | > | > | | > > > > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | if (![entry hasPrefix: cNonce]) @throw [XMPPAuthFailedException newWithClass: isa connection: nil reason: @"Received wrong nonce"]; sNonce = entry; got |= GOT_SNONCE; } else if ([comp hasPrefix: @"s="]) { salt = [OFDataArray dataArrayWithBase64EncodedString: entry]; 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]; [tmpArray addNItems: [GS2Header cStringLength] fromCArray: [GS2Header cString]]; tmpString = [tmpArray stringByBase64Encoding]; [ret addNItems: 2 |
︙ | ︙ |