aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorSteven Danneman <sdanneman@securityinnovation.com>2017-06-27 15:53:11 -0700
committerRich Salz <rsalz@openssl.org>2017-06-29 08:20:14 -0400
commit8530039a307f7aa8acb0516fdd38191baa91d434 (patch)
tree0a19127e33f8b41710472db53f63f6eba57cc510 /apps
parent6fc1d33c90015d3ad5738ec99aaa12fdb9640295 (diff)
downloadopenssl-8530039a307f7aa8acb0516fdd38191baa91d434.tar.gz
Fix double array increment in s_client mysql connect
The packet parsing code for the server version string was incrementing the array index twice on every iteration. This meant that strings with an even number of characters would pass, but strings with an odd number (ex: 5.7.18-0ubuntu0.16.04.1) would cause the pos variable to get out of sync. This would cause a later failure with "MySQL packet is broken." CLA: trivial Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3799)
Diffstat (limited to 'apps')
-rw-r--r--apps/s_client.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/apps/s_client.c b/apps/s_client.c
index 393b311904..56209ac0f6 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -2406,10 +2406,9 @@ int s_client_main(int argc, char **argv)
} else if (packet[pos++] == '\0') {
break;
}
- pos++;
}
- /* make sure we have more 15 bytes left in the packet */
+ /* make sure we have at least 15 bytes left in the packet */
if (pos + 15 > bytes) {
BIO_printf(bio_err,
"MySQL server handshake packet is broken.\n");