[BACK]Return to misc.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/misc.c between version 1.69 and 1.70

version 1.69, 2008/06/13 01:38:23 version 1.70, 2009/01/22 10:02:34
Line 208 
Line 208 
   
 /*  /*
  * Convert ASCII string to TCP/IP port number.   * Convert ASCII string to TCP/IP port number.
  * Port must be >0 and <=65535.   * Port must be >=0 and <=65535.
  * Return 0 if invalid.   * Return -1 if invalid.
  */   */
 int  int
 a2port(const char *s)  a2port(const char *s)
 {  {
         long port;          long long port;
         char *endp;          const char *errstr;
   
         errno = 0;          port = strtonum(s, 0, 65535, &errstr);
         port = strtol(s, &endp, 0);          if (errstr != NULL)
         if (s == endp || *endp != '\0' ||                  return -1;
             (errno == ERANGE && (port == LONG_MIN || port == LONG_MAX)) ||          return (int)port;
             port <= 0 || port > 65535)  
                 return 0;  
   
         return port;  
 }  }
   
 int  int

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.70