]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
rm some magic numbers in ssh_setup_portfwd()
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Fri, 4 Mar 2005 01:20:20 +0000 (01:20 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
Fri, 4 Mar 2005 01:20:20 +0000 (01:20 +0000)
[originally from svn r5439]

ssh.c

diff --git a/ssh.c b/ssh.c
index b9d906d83e74a9db85035ca18ca0e24003f70d04..0435dd7ec25373c3b02affcad1bd9960bc6192a4 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -3911,7 +3911,7 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
                    strcpy(saddr, sports);
                n = 0;
            }
-           if (n < 255) sports[n++] = *portfwd_strptr++;
+           if (n < lenof(sports)-1) sports[n++] = *portfwd_strptr++;
        }
        sports[n] = 0;
        if (type != 'D') {
@@ -3919,14 +3919,14 @@ static void ssh_setup_portfwd(Ssh ssh, const Config *cfg)
                portfwd_strptr++;
            n = 0;
            while (*portfwd_strptr && *portfwd_strptr != ':') {
-               if (n < 255) host[n++] = *portfwd_strptr++;
+               if (n < lenof(host)-1) host[n++] = *portfwd_strptr++;
            }
            host[n] = 0;
            if (*portfwd_strptr == ':')
                portfwd_strptr++;
            n = 0;
            while (*portfwd_strptr) {
-               if (n < 255) dports[n++] = *portfwd_strptr++;
+               if (n < lenof(dports)-1) dports[n++] = *portfwd_strptr++;
            }
            dports[n] = 0;
            portfwd_strptr++;