aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2018-08-16 10:25:46 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-08-16 17:51:05 +0200
commit6848c23d8445dca2f76569b5fcdda0babf02e9ea (patch)
tree116e2cf933b4a0f0933dd0a142b069454f5b24cf
parent4104d2fb917d7d31d9c1ecb91fde1370e517c318 (diff)
downloadlibssh-6848c23d8445dca2f76569b5fcdda0babf02e9ea.tar.gz
libssh-6848c23d8445dca2f76569b5fcdda0babf02e9ea.tar.xz
libssh-6848c23d8445dca2f76569b5fcdda0babf02e9ea.zip
config: Do not access negative indexes of seen array
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
-rw-r--r--src/config.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index 12792afd..49f221e6 100644
--- a/src/config.c
+++ b/src/config.c
@@ -383,7 +383,8 @@ static int ssh_config_parse_line(ssh_session session, const char *line,
}
opcode = ssh_config_get_opcode(keyword);
- if (*parsing == 1 && opcode != SOC_HOST && opcode != SOC_UNSUPPORTED && opcode != SOC_INCLUDE) {
+ if (*parsing == 1 && opcode != SOC_HOST && opcode != SOC_INCLUDE &&
+ opcode > SOC_UNSUPPORTED) { /* Ignore all unknown types here */
if (seen[opcode] != 0) {
SAFE_FREE(x);
return 0;