Fix segfaults in terminal resizing, introduced by re-engineering.
[u/mdw/putty] / plink.c
diff --git a/plink.c b/plink.c
index 307d729..f6e2a70 100644 (file)
--- a/plink.c
+++ b/plink.c
@@ -484,7 +484,7 @@ int main(int argc, char **argv)
 
     /* See if host is of the form user@host */
     if (cfg.host[0] != '\0') {
-       char *atsign = strchr(cfg.host, '@');
+       char *atsign = strrchr(cfg.host, '@');
        /* Make sure we're not overflowing the user field */
        if (atsign) {
            if (atsign - cfg.host < sizeof cfg.username) {