git-revert documentation: refer to new HOWTO on reverting faulty merges
[gitweb.git] / connect.c
index 584e04c217da4ea8943e33c77fea56ce64547ed1..2f55ad2c256bc01b3062b99251af4386eef5af22 100644 (file)
--- a/connect.c
+++ b/connect.c
@@ -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;
                }