Skip to content

Commit fd6dd00

Browse files
committed
DoProtoId: case-sensitive match on SSH- prefix
Per RFC 4253 4.2. Also updated unit test. Issue: F-2865
1 parent 404a5be commit fd6dd00

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/internal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10904,8 +10904,8 @@ int DoProtoId(WOLFSSH* ssh)
1090410904
eolSz = (*eol == '\r') ? 2 : 1;
1090510905

1090610906
if (ssh->inputBuffer.length >= SSH_PROTO_SZ
10907-
&& WSTRNCASECMP((char*)ssh->inputBuffer.buffer,
10908-
ssh->ctx->sshProtoIdStr, SSH_PROTO_SZ) == 0) {
10907+
&& WSTRNCMP((char*)ssh->inputBuffer.buffer,
10908+
ssh->ctx->sshProtoIdStr, SSH_PROTO_SZ) == 0) {
1090910909

1091010910
if (ssh->ctx->side == WOLFSSH_ENDPOINT_SERVER)
1091110911
ssh->clientState = CLIENT_VERSION_DONE;

tests/unit.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ static const ProtoIdTestVector protoIdTestVectors[] = {
8787
"SSH-2.0-wolfSSHv" LIBWOLFSSH_VERSION_STRING "\n",
8888
0, WS_SUCCESS, WOLFSSH_ENDPOINT_CLIENT },
8989

90-
/* Case-insensitive match. DoProtoId uses WSTRNCASECMP. */
90+
/* Case-insensitive match. DoProtoId uses WSTRNCMP. */
9191
{ "lowercase ssh prefix",
9292
"ssh-2.0-wolfSSHv" LIBWOLFSSH_VERSION_STRING "\r\n",
93-
0, WS_SUCCESS, WOLFSSH_ENDPOINT_CLIENT },
93+
0, WS_VERSION_E, WOLFSSH_ENDPOINT_CLIENT },
9494
{ "mixed case SSH prefix",
9595
"Ssh-2.0-wolfSSHv" LIBWOLFSSH_VERSION_STRING "\r\n",
96-
0, WS_SUCCESS, WOLFSSH_ENDPOINT_CLIENT },
96+
0, WS_VERSION_E, WOLFSSH_ENDPOINT_CLIENT },
9797

9898
/* OpenSSH peer identification. */
9999
{ "OpenSSH version string",

0 commit comments

Comments
 (0)