Changeset 6012:550212836c8f in nginx


Ignore:
Timestamp:
03/16/15 21:26:22 (5 years ago)
Author:
Ruslan Ermilov <ru@…>
Branch:
default
Phase:
public
Message:

Overflow detection in ngx_inet_addr().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/core/ngx_inet.c

    r5473 r6012  
    2828    for (p = text; p < text + len; p++) {
    2929
     30        if (octet > 255) {
     31            return INADDR_NONE;
     32        }
     33
    3034        c = *p;
    3135
     
    3539        }
    3640
    37         if (c == '.' && octet < 256) {
     41        if (c == '.') {
    3842            addr = (addr << 8) + octet;
    3943            octet = 0;
     
    4549    }
    4650
    47     if (n == 3 && octet < 256) {
     51    if (n == 3) {
    4852        addr = (addr << 8) + octet;
    4953        return htonl(addr);
Note: See TracChangeset for help on using the changeset viewer.