[PATCH] check that last IPv4 octet has valid value
Maxim Dounin
mdounin at mdounin.ru
Tue Apr 28 15:50:07 UTC 2015
Hello!
On Tue, Apr 28, 2015 at 06:31:06PM +0300, Ruslan Ermilov wrote:
> On Tue, Apr 28, 2015 at 06:12:01PM +0300, Sergey Polovko wrote:
> > # HG changeset patch
> > # User Sergey Polovko <jamel at yandex-team.ru>
> > # Date 1430232559 -10800
> > # Tue Apr 28 17:49:19 2015 +0300
> > # Node ID e98e249441adc75c525556ca32e9f3e65e87f653
> > # Parent 96e22e4f1b03ff15a774c6ed34d74b897af32c55
> > check that last IPv4 octet has valid value
> >
> > diff -r 96e22e4f1b03 -r e98e249441ad src/core/ngx_inet.c
> > --- a/src/core/ngx_inet.c Mon Apr 27 18:51:18 2015 +0300
> > +++ b/src/core/ngx_inet.c Tue Apr 28 17:49:19 2015 +0300
> > @@ -48,7 +48,7 @@
> > return INADDR_NONE;
> > }
> >
> > - if (n == 3) {
> > + if (n == 3 && octet <= 255) {
> > addr = (addr << 8) + octet;
> > return htonl(addr);
> > }
>
> http://hg.nginx.org/nginx/rev/550212836c8f
So, the commit is actually wrong: the "octet < 256" check is
needed.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list