aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libssh-hostname-parser-bug.patch
blob: de2336e86d3d33c3f06ce51aa4a459953e3230b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
It does not handle the case for the unsupported opcode (-1)
which would cause a segfault when accessing the "seen" array.

diff --git a/src/config.c b/src/config.c
index c5313ec8..72e07639 100644
--- a/src/config.c
+++ b/src/config.c
@@ -218,7 +218,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) {
+  if (*parsing == 1 && opcode != SOC_HOST &&
+      opcode > SOC_UNSUPPORTED && opcode < SOC_END) {
       if (seen[opcode] != 0) {
           return 0;
       }