mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-05 21:42:47 -05:00
Fix for `hostname-whitespace'; thanks to Justin Bradford.
[originally from svn r2080]
This commit is contained in:
15
psftp.c
15
psftp.c
@ -1745,6 +1745,21 @@ static int psftp_connect(char *userhost, char *user, int portnumber)
|
||||
*/
|
||||
cfg.host[strcspn(cfg.host, ":")] = '\0';
|
||||
|
||||
/*
|
||||
* Remove any remaining whitespace from the hostname.
|
||||
*/
|
||||
{
|
||||
int p1 = 0, p2 = 0;
|
||||
while (cfg.host[p2] != '\0') {
|
||||
if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') {
|
||||
cfg.host[p1] = cfg.host[p2];
|
||||
p1++;
|
||||
}
|
||||
p2++;
|
||||
}
|
||||
cfg.host[p1] = '\0';
|
||||
}
|
||||
|
||||
/* Set username */
|
||||
if (user != NULL && user[0] != '\0') {
|
||||
strncpy(cfg.username, user, sizeof(cfg.username) - 1);
|
||||
|
Reference in New Issue
Block a user