]> sjero.net Git - wget/blobdiff - src/url.c
[svn] Reject port numbers greater than 65535.
[wget] / src / url.c
index da270019ccea36f24f657253ca5de11fc0179dac..35ae5f814a4fa413a12f53064da911486acd67c8 100644 (file)
--- a/src/url.c
+++ b/src/url.c
@@ -781,6 +781,13 @@ url_parse (const char *url, int *error)
                  goto error;
                }
              port = 10 * port + (*pp - '0');
+             /* Check for too large port numbers here, before we have
+                a chance to overflow on bogus port values.  */
+             if (port > 65535)
+               {
+                 error_code = PE_BAD_PORT_NUMBER;
+                 goto error;
+               }
            }
        }
     }