X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=connect.c;h=2f23ab3b87e500137fe0af957901c30e61434564;hb=35d5ae679c2a6bc2a5f70f9209844ae8c14ae9e3;hp=584e04c217da4ea8943e33c77fea56ce64547ed1;hpb=ea4f2bd39dcfabb23e86b2f79149c6c4038ff3cd;p=git.git diff --git a/connect.c b/connect.c index 584e04c21..2f23ab3b8 100644 --- a/connect.c +++ b/connect.c @@ -315,7 +315,7 @@ static int git_tcp_connect_sock(char *host, int flags) /* Not numeric */ struct servent *se = getservbyname(port,"tcp"); if ( !se ) - die("Unknown port %s\n", port); + die("Unknown port %s", port); nport = se->s_port; } @@ -480,8 +480,8 @@ char *get_port(char *host) char *p = strchr(host, ':'); if (p) { - strtol(p+1, &end, 10); - if (*end == '\0') { + long port = strtol(p + 1, &end, 10); + if (end != p + 1 && *end == '\0' && 0 <= port && port < 65536) { *p = '\0'; return p+1; }