BProxySecureSocket: Fix obviously untested code.

* Actually set status before testing it
 * sscanf (reads from passed buffer) not scanf (reads from stdin)
 * &httpStatus not httpStatus.

Found by Coverity.
This commit is contained in:
Augustin Cavalier 2017-11-23 17:44:44 +01:00
parent 14fcbb52cd
commit 75fa008e23

View File

@ -47,7 +47,7 @@ BProxySecureSocket::Connect(const BNetworkAddress& peer, bigtime_t timeout)
if (status != B_OK)
return status;
BSocket::Connect(fProxyAddress, timeout);
status = BSocket::Connect(fProxyAddress, timeout);
if (status != B_OK)
return status;
@ -63,7 +63,7 @@ BProxySecureSocket::Connect(const BNetworkAddress& peer, bigtime_t timeout)
buffer[length] = '\0';
int httpStatus = 0;
int matches = scanf(buffer, "HTTP/1.0 %d %*[^\r\n]\r\n\r\n", httpStatus);
int matches = sscanf(buffer, "HTTP/1.0 %d %*[^\r\n]\r\n\r\n", &httpStatus);
if (matches != 2)
return B_BAD_DATA;