]> sjero.net Git - wget/commitdiff
[svn] Reject port numbers greater than 65535.
authorhniksic <devnull@localhost>
Sun, 6 Mar 2005 16:34:00 +0000 (08:34 -0800)
committerhniksic <devnull@localhost>
Sun, 6 Mar 2005 16:34:00 +0000 (08:34 -0800)
src/ChangeLog
src/url.c

index ad58ea50735f55bf1def7f64101c80b121920cfa..9547bd7e751a5c8179d6ffad09b9ad500205778b 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-06  Hrvoje Niksic  <hniksic@xemacs.org>
+
+       * url.c (url_parse): Reject port numbers larger than 65535.  We
+       also check for overflow while parsing port numbers.
+
 2005-03-06  Hrvoje Niksic  <hniksic@xemacs.org>
 
        * utils.c (read_file): Don't use wgint for file size; LFS won't
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;
+               }
            }
        }
     }