diff options
author | QC <qball@gmpclient.org> | 2015-01-10 15:31:13 +0100 |
---|---|---|
committer | QC <qball@gmpclient.org> | 2015-01-10 15:31:13 +0100 |
commit | f28ac717cd2285719131a63b5896b7ed32b2a089 (patch) | |
tree | c82f271c3c3e3af8efa1a0ee4158f15a6f104ddf | |
parent | 7e6a24f9b6908cfb37632a68e0eb797f2624981e (diff) |
Fix 101
-rw-r--r-- | source/ssh-dialog.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/source/ssh-dialog.c b/source/ssh-dialog.c index 8316eb80..9cf7f10d 100644 --- a/source/ssh-dialog.c +++ b/source/ssh-dialog.c @@ -138,7 +138,17 @@ static char ** get_ssh ( unsigned int *length ) if ( fd != NULL ) { char buffer[1024]; while ( fgets ( buffer, 1024, fd ) != NULL ) { - if ( strncasecmp ( buffer, "Host", 4 ) == 0 && isspace ( buffer[4] ) ) { + char *token = &buffer[0]; + // Skip initial spaces. + while ( ( *token ) != '\n' && ( *token ) != '\0' && isspace ( *token ) ) { + token++; + } + // Skip empty lines. + if ( ( *token ) == '\n' || ( *token ) == '\0' ) { + continue; + } + // Check for "Host[::space::]" + if ( strncasecmp ( token, "Host", 4 ) == 0 && isspace ( token[4] ) ) { int start = 0, stop = 0; buffer[strlen ( buffer ) - 1] = '\0'; |