[PATCH] check that last IPv4 octet has valid value

Sergey Polovko jamel at yandex-team.ru
Tue Apr 28 15:12:01 UTC 2015


# 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);
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20150428/f12ef54f/attachment.html>


More information about the nginx-devel mailing list