src/http/ngx_http_header_filter_module.c:489: error: Buffer Overrun L3
  Offset: [0, 131077] Size: [0, +oo] by call to `ngx_sprintf`.

src/http/ngx_http_header_filter_module.c:430:5: Assignment
428. 
429.     /* "HTTP/1.x " */
430.     b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1);
         ^
431. 
432.     /* status line */

src/http/ngx_http_header_filter_module.c:489:19: Call
487.         && r->headers_out.content_length_n >= 0)
488.     {
489.         b->last = ngx_sprintf(b->last, "Content-Length: %O" CRLF,
                       ^
490.                               r->headers_out.content_length_n);
491.     }

src/core/ngx_string.c:95:1: Parameter `*buf`
  93. 
  94. 
  95. u_char * ngx_cdecl
      ^
  96. ngx_sprintf(u_char *buf, const char *fmt, ...)
  97. {

src/core/ngx_string.c:102:9: Call
  100. 
  101.     va_start(args, fmt);
  102.     p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args);
               ^
  103.     va_end(args);
  104. 

src/core/ngx_string.c:123:1: <Length trace>
121. 
122. 
123. u_char *
     ^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {

src/core/ngx_string.c:123:1: Parameter `*buf`
    121. 
    122. 
    123. u_char *
         ^
    124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
    125. {

src/core/ngx_string.c:244:25: Array access: Offset: [0, 131077] Size: [0, +oo] by call to `ngx_sprintf` 
    242.                 if (slen == (size_t) -1) {
    243.                     while (*p && buf < last) {
    244.                         *buf++ = *p++;
                                 ^
    245.                     }
    246. 

u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
    u_char                *p, zero, *last;
    int                    d;
    float                  f, scale;
    size_t                 len, slen;
    int64_t                i64;
    uint64_t               ui64;
    ngx_msec_t             ms;
    ngx_uint_t             width, sign, hex, max_width, frac_width, i;
    ngx_str_t             *v;
    ngx_variable_value_t  *vv;
    if (max == 0) {
        return buf;
    }
    last = buf + max;
    while (*fmt && buf < last) {
        if (*fmt == '%') {
            i64 = 0;
            ui64 = 0;
            zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
            width = 0;
            sign = 1;
            hex = 0;
            max_width = 0;
            frac_width = 0;
            slen = (size_t) -1;
            while (*fmt >= '0' && *fmt <= '9') {
                width = width * 10 + *fmt++ - '0';
            }
            for ( ;; ) {
                switch (*fmt) {
                case 'u':
                    sign = 0;
                    fmt++;
                    continue;
                case 'm':
                    max_width = 1;
                    fmt++;
                    continue;
                case 'X':
                    hex = 2;
                    sign = 0;
                    fmt++;
                    continue;
                case 'x':
                    hex = 1;
                    sign = 0;
                    fmt++;
                    continue;
                case '.':
                    fmt++;
                    while (*fmt >= '0' && *fmt <= '9') {
                        frac_width = frac_width * 10 + *fmt++ - '0';
                    }
                    break;
                case '*':
                    slen = va_arg(args, size_t);
                    fmt++;
                    continue;
                default:
                    break;
                }
                break;
            }
            switch (*fmt) {
            case 'V':
                v = va_arg(args, ngx_str_t *);
                len = v->len;
                len = (buf + len < last) ? len : (size_t) (last - buf);
                buf = ngx_cpymem(buf, v->data, len);
                fmt++;
                continue;
            case 'v':
                vv = va_arg(args, ngx_variable_value_t *);
                len = vv->len;
                len = (buf + len < last) ? len : (size_t) (last - buf);
                buf = ngx_cpymem(buf, vv->data, len);
                fmt++;
                continue;
            case 's':
                p = va_arg(args, u_char *);
                if (slen == (size_t) -1) {
                    while (*p && buf < last) {
                        *buf++ = *p++;
                    }
                } else {
                    len = (buf + slen < last) ? slen : (size_t) (last - buf);
                    buf = ngx_cpymem(buf, p, len);
                }
                fmt++;
                continue;
            case 'O':
                i64 = (int64_t) va_arg(args, off_t);
                sign = 1;
                break;
            case 'P':
                i64 = (int64_t) va_arg(args, ngx_pid_t);
                sign = 1;
                break;
            case 'T':
                i64 = (int64_t) va_arg(args, time_t);
                sign = 1;
                break;
            case 'M':
                ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
                if ((ngx_msec_int_t) ms == -1) {
                    sign = 1;
                    i64 = -1;
                } else {
                    sign = 0;
                    ui64 = (uint64_t) ms;
                }
                break;
            case 'z':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ssize_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, size_t);
                }
                break;
            case 'i':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ngx_int_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, ngx_uint_t);
                }
                if (max_width) {
                    width = NGX_INT_T_LEN;
                }
                break;
            case 'd':
                if (sign) {
                    i64 = (int64_t) va_arg(args, int);
                } else {
                    ui64 = (uint64_t) va_arg(args, u_int);
                }
                break;
            case 'l':
                if (sign) {
                    i64 = (int64_t) va_arg(args, long);
                } else {
                    ui64 = (uint64_t) va_arg(args, u_long);
                }
                break;
            case 'D':
                if (sign) {
                    i64 = (int64_t) va_arg(args, int32_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, uint32_t);
                }
                break;
            case 'L':
                if (sign) {
                    i64 = va_arg(args, int64_t);
                } else {
                    ui64 = va_arg(args, uint64_t);
                }
                break;
            case 'A':
                if (sign) {
                    i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
                } else {
                    ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
                }
                if (max_width) {
                    width = NGX_ATOMIC_T_LEN;
                }
                break;
            case 'f':
                f = (float) va_arg(args, double);
                if (f < 0) {
                    *buf++ = '-';
                    f = -f;
                }
                ui64 = (int64_t) f;
                buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
                if (frac_width) {
                    if (buf < last) {
                        *buf++ = '.';
                    }
                    scale = 1.0;
                    for (i = 0; i < frac_width; i++) {
                        scale *= 10.0;
                    }
                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
                    buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
                }
                fmt++;
                continue;
#if !(NGX_WIN32)
            case 'r':
                i64 = (int64_t) va_arg(args, rlim_t);
                sign = 1;
                break;
#endif
            case 'p':
                ui64 = (uintptr_t) va_arg(args, void *);
                hex = 2;
                sign = 0;
                zero = '0';
                width = NGX_PTR_SIZE * 2;
                break;
            case 'c':
                d = va_arg(args, int);
                *buf++ = (u_char) (d & 0xff);
                fmt++;
                continue;
            case 'Z':
                *buf++ = '\0';
                fmt++;
                continue;
            case 'N':
#if (NGX_WIN32)
                *buf++ = CR;
#endif
                *buf++ = LF;
                fmt++;
                continue;
            case '%':
                *buf++ = '%';
                fmt++;
                continue;
            default:
                *buf++ = *fmt++;
                continue;
            }
            if (sign) {
                if (i64 < 0) {
                    *buf++ = '-';
                    ui64 = (uint64_t) -i64;
                } else {
                    ui64 = (uint64_t) i64;
                }
            }
            buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
            fmt++;
        } else {
            *buf++ = *fmt++;
        }
    }
    return buf;
}
['static ngx_int_t\nngx_http_header_filter(ngx_http_request_t *r)\n{\n    u_char                    *p;\n    size_t                     len;\n    ngx_str_t                  host, *status_line;\n    ngx_buf_t                 *b;\n    ngx_uint_t                 status, i, port;\n    ngx_chain_t                out;\n    ngx_list_part_t           *part;\n    ngx_table_elt_t           *header;\n    ngx_http_core_loc_conf_t  *clcf;\n    ngx_http_core_srv_conf_t  *cscf;\n    struct sockaddr_in        *sin;\n#if (NGX_HAVE_INET6)\n    struct sockaddr_in6       *sin6;\n#endif\n    u_char                     addr[NGX_SOCKADDR_STRLEN];\n    r->header_sent = 1;\n    if (r != r->main) {\n        return NGX_OK;\n    }\n    if (r->http_version < NGX_HTTP_VERSION_10) {\n        return NGX_OK;\n    }\n    if (r->method == NGX_HTTP_HEAD) {\n        r->header_only = 1;\n    }\n    if (r->headers_out.last_modified_time != -1) {\n        if (r->headers_out.status != NGX_HTTP_OK\n            && r->headers_out.status != NGX_HTTP_PARTIAL_CONTENT\n            && r->headers_out.status != NGX_HTTP_NOT_MODIFIED)\n        {\n            r->headers_out.last_modified_time = -1;\n            r->headers_out.last_modified = NULL;\n        }\n    }\n    len = sizeof("HTTP/1.x ") - 1 + sizeof(CRLF) - 1\n          + sizeof(CRLF) - 1;\n    if (r->headers_out.status_line.len) {\n        len += r->headers_out.status_line.len;\n        status_line = &r->headers_out.status_line;\n#if (NGX_SUPPRESS_WARN)\n        status = 0;\n#endif\n    } else {\n        status = r->headers_out.status;\n        if (status >= NGX_HTTP_OK\n            && status < NGX_HTTP_LAST_LEVEL_200)\n        {\n            if (status == NGX_HTTP_NO_CONTENT) {\n                r->header_only = 1;\n                r->headers_out.content_type.len = 0;\n                r->headers_out.content_type.data = NULL;\n                r->headers_out.last_modified_time = -1;\n                r->headers_out.last_modified = NULL;\n                r->headers_out.content_length = NULL;\n                r->headers_out.content_length_n = -1;\n            }\n            status -= NGX_HTTP_OK;\n            status_line = &ngx_http_status_lines[status];\n            len += ngx_http_status_lines[status].len;\n        } else if (status >= NGX_HTTP_MOVED_PERMANENTLY\n                   && status < NGX_HTTP_LAST_LEVEL_300)\n        {\n            if (status == NGX_HTTP_NOT_MODIFIED) {\n                r->header_only = 1;\n            }\n            status = status - NGX_HTTP_MOVED_PERMANENTLY + NGX_HTTP_LEVEL_200;\n            status_line = &ngx_http_status_lines[status];\n            len += ngx_http_status_lines[status].len;\n        } else if (status >= NGX_HTTP_BAD_REQUEST\n                   && status < NGX_HTTP_LAST_LEVEL_400)\n        {\n            status = status - NGX_HTTP_BAD_REQUEST\n                            + NGX_HTTP_LEVEL_200\n                            + NGX_HTTP_LEVEL_300;\n            status_line = &ngx_http_status_lines[status];\n            len += ngx_http_status_lines[status].len;\n        } else if (status >= NGX_HTTP_INTERNAL_SERVER_ERROR\n                   && status < NGX_HTTP_LAST_LEVEL_500)\n        {\n            status = status - NGX_HTTP_INTERNAL_SERVER_ERROR\n                            + NGX_HTTP_LEVEL_200\n                            + NGX_HTTP_LEVEL_300\n                            + NGX_HTTP_LEVEL_400;\n            status_line = &ngx_http_status_lines[status];\n            len += ngx_http_status_lines[status].len;\n        } else {\n            len += NGX_INT_T_LEN;\n            status_line = NULL;\n        }\n    }\n    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);\n    if (r->headers_out.server == NULL) {\n        len += clcf->server_tokens ? sizeof(ngx_http_server_full_string) - 1:\n                                     sizeof(ngx_http_server_string) - 1;\n    }\n    if (r->headers_out.date == NULL) {\n        len += sizeof("Date: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;\n    }\n    if (r->headers_out.content_type.len) {\n        len += sizeof("Content-Type: ") - 1\n               + r->headers_out.content_type.len + 2;\n        if (r->headers_out.content_type_len == r->headers_out.content_type.len\n            && r->headers_out.charset.len)\n        {\n            len += sizeof("; charset=") - 1 + r->headers_out.charset.len;\n        }\n    }\n    if (r->headers_out.content_length == NULL\n        && r->headers_out.content_length_n >= 0)\n    {\n        len += sizeof("Content-Length: ") - 1 + NGX_OFF_T_LEN + 2;\n    }\n    if (r->headers_out.last_modified == NULL\n        && r->headers_out.last_modified_time != -1)\n    {\n        len += sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT" CRLF) - 1;\n    }\n    if (r->headers_out.location\n        && r->headers_out.location->value.len\n        && r->headers_out.location->value.data[0] == \'/\')\n    {\n        r->headers_out.location->hash = 0;\n        if (clcf->server_name_in_redirect) {\n            cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);\n            host = cscf->server_name;\n        } else if (r->headers_in.server.len) {\n            host = r->headers_in.server;\n        } else {\n            host.len = NGX_SOCKADDR_STRLEN;\n            host.data = addr;\n            if (ngx_http_server_addr(r, &host) != NGX_OK) {\n                return NGX_ERROR;\n            }\n        }\n        switch (r->connection->local_sockaddr->sa_family) {\n#if (NGX_HAVE_INET6)\n        case AF_INET6:\n            sin6 = (struct sockaddr_in6 *) r->connection->local_sockaddr;\n            port = ntohs(sin6->sin6_port);\n            break;\n#endif\n        default:\n            sin = (struct sockaddr_in *) r->connection->local_sockaddr;\n            port = ntohs(sin->sin_port);\n            break;\n        }\n        len += sizeof("Location: https://") - 1\n               + host.len\n               + r->headers_out.location->value.len + 2;\n        if (clcf->port_in_redirect) {\n#if (NGX_HTTP_SSL)\n            if (r->connection->ssl)\n                port = (port == 443) ? 0 : port;\n            else\n#endif\n                port = (port == 80) ? 0 : port;\n        }\n        if (port) {\n            len += sizeof(":65535") - 1;\n        }\n    } else {\n        host.len = 0;\n        host.data = NULL;\n        port = 0;\n    }\n    if (r->chunked) {\n        len += sizeof("Transfer-Encoding: chunked" CRLF) - 1;\n    }\n    if (r->keepalive) {\n        len += sizeof("Connection: keep-alive" CRLF) - 1;\n        if (clcf->keepalive_header) {\n            len += sizeof("Keep-Alive: timeout=") - 1 + NGX_TIME_T_LEN + 2;\n        }\n    } else {\n        len += sizeof("Connection: closed" CRLF) - 1;\n    }\n#if (NGX_HTTP_GZIP)\n    if (r->gzip && clcf->gzip_vary) {\n        len += sizeof("Vary: Accept-Encoding" CRLF) - 1;\n    }\n#endif\n    part = &r->headers_out.headers.part;\n    header = part->elts;\n    for (i = 0;  ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            header = part->elts;\n            i = 0;\n        }\n        if (header[i].hash == 0) {\n            continue;\n        }\n        len += header[i].key.len + sizeof(": ") - 1 + header[i].value.len\n               + sizeof(CRLF) - 1;\n    }\n    b = ngx_create_temp_buf(r->pool, len);\n    if (b == NULL) {\n        return NGX_ERROR;\n    }\n    b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1);\n    if (status_line) {\n        b->last = ngx_copy(b->last, status_line->data, status_line->len);\n    } else {\n        b->last = ngx_sprintf(b->last, "%ui", status);\n    }\n    *b->last++ = CR; *b->last++ = LF;\n    if (r->headers_out.server == NULL) {\n        if (clcf->server_tokens) {\n            p = (u_char *) ngx_http_server_full_string;\n            len = sizeof(ngx_http_server_full_string) - 1;\n        } else {\n            p = (u_char *) ngx_http_server_string;\n            len = sizeof(ngx_http_server_string) - 1;\n        }\n        b->last = ngx_cpymem(b->last, p, len);\n    }\n    if (r->headers_out.date == NULL) {\n        b->last = ngx_cpymem(b->last, "Date: ", sizeof("Date: ") - 1);\n        b->last = ngx_cpymem(b->last, ngx_cached_http_time.data,\n                             ngx_cached_http_time.len);\n        *b->last++ = CR; *b->last++ = LF;\n    }\n    if (r->headers_out.content_type.len) {\n        b->last = ngx_cpymem(b->last, "Content-Type: ",\n                             sizeof("Content-Type: ") - 1);\n        p = b->last;\n        b->last = ngx_copy(b->last, r->headers_out.content_type.data,\n                           r->headers_out.content_type.len);\n        if (r->headers_out.content_type_len == r->headers_out.content_type.len\n            && r->headers_out.charset.len)\n        {\n            b->last = ngx_cpymem(b->last, "; charset=",\n                                 sizeof("; charset=") - 1);\n            b->last = ngx_copy(b->last, r->headers_out.charset.data,\n                               r->headers_out.charset.len);\n            r->headers_out.content_type.len = b->last - p;\n            r->headers_out.content_type.data = p;\n        }\n        *b->last++ = CR; *b->last++ = LF;\n    }\n    if (r->headers_out.content_length == NULL\n        && r->headers_out.content_length_n >= 0)\n    {\n        b->last = ngx_sprintf(b->last, "Content-Length: %O" CRLF,\n                              r->headers_out.content_length_n);\n    }\n    if (r->headers_out.last_modified == NULL\n        && r->headers_out.last_modified_time != -1)\n    {\n        b->last = ngx_cpymem(b->last, "Last-Modified: ",\n                             sizeof("Last-Modified: ") - 1);\n        b->last = ngx_http_time(b->last, r->headers_out.last_modified_time);\n        *b->last++ = CR; *b->last++ = LF;\n    }\n    if (host.data) {\n        p = b->last + sizeof("Location: ") - 1;\n        b->last = ngx_cpymem(b->last, "Location: http",\n                             sizeof("Location: http") - 1);\n#if (NGX_HTTP_SSL)\n        if (r->connection->ssl) {\n            *b->last++ =\'s\';\n        }\n#endif\n        *b->last++ = \':\'; *b->last++ = \'/\'; *b->last++ = \'/\';\n        b->last = ngx_copy(b->last, host.data, host.len);\n        if (port) {\n            b->last = ngx_sprintf(b->last, ":%ui", port);\n        }\n        b->last = ngx_copy(b->last, r->headers_out.location->value.data,\n                           r->headers_out.location->value.len);\n        r->headers_out.location->value.len = b->last - p;\n        r->headers_out.location->value.data = p;\n        r->headers_out.location->key.len = sizeof("Location: ") - 1;\n        r->headers_out.location->key.data = (u_char *) "Location: ";\n        *b->last++ = CR; *b->last++ = LF;\n    }\n    if (r->chunked) {\n        b->last = ngx_cpymem(b->last, "Transfer-Encoding: chunked" CRLF,\n                             sizeof("Transfer-Encoding: chunked" CRLF) - 1);\n    }\n    if (r->keepalive) {\n        b->last = ngx_cpymem(b->last, "Connection: keep-alive" CRLF,\n                             sizeof("Connection: keep-alive" CRLF) - 1);\n        if (clcf->keepalive_header) {\n            b->last = ngx_sprintf(b->last, "Keep-Alive: timeout=%T" CRLF,\n                                  clcf->keepalive_header);\n        }\n    } else {\n        b->last = ngx_cpymem(b->last, "Connection: close" CRLF,\n                             sizeof("Connection: close" CRLF) - 1);\n    }\n#if (NGX_HTTP_GZIP)\n    if (r->gzip && clcf->gzip_vary) {\n        b->last = ngx_cpymem(b->last, "Vary: Accept-Encoding" CRLF,\n                             sizeof("Vary: Accept-Encoding" CRLF) - 1);\n    }\n#endif\n    part = &r->headers_out.headers.part;\n    header = part->elts;\n    for (i = 0;  ; i++) {\n        if (i >= part->nelts) {\n            if (part->next == NULL) {\n                break;\n            }\n            part = part->next;\n            header = part->elts;\n            i = 0;\n        }\n        if (header[i].hash == 0) {\n            continue;\n        }\n        b->last = ngx_copy(b->last, header[i].key.data, header[i].key.len);\n        *b->last++ = \':\'; *b->last++ = \' \';\n        b->last = ngx_copy(b->last, header[i].value.data, header[i].value.len);\n        *b->last++ = CR; *b->last++ = LF;\n    }\n    ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,\n                   "%*s", (size_t) (b->last - b->pos), b->pos);\n    *b->last++ = CR; *b->last++ = LF;\n    r->header_size = b->last - b->pos;\n    if (r->header_only) {\n        b->last_buf = 1;\n    }\n    out.buf = b;\n    out.next = NULL;\n    return ngx_http_write_filter(r, &out);\n}', 'u_char * ngx_cdecl\nngx_sprintf(u_char *buf, const char *fmt, ...)\n{\n    u_char   *p;\n    va_list   args;\n    va_start(args, fmt);\n    p = ngx_vsnprintf(buf,   65536, fmt, args);\n    va_end(args);\n    return p;\n}', "u_char *\nngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)\n{\n    u_char                *p, zero, *last;\n    int                    d;\n    float                  f, scale;\n    size_t                 len, slen;\n    int64_t                i64;\n    uint64_t               ui64;\n    ngx_msec_t             ms;\n    ngx_uint_t             width, sign, hex, max_width, frac_width, i;\n    ngx_str_t             *v;\n    ngx_variable_value_t  *vv;\n    if (max == 0) {\n        return buf;\n    }\n    last = buf + max;\n    while (*fmt && buf < last) {\n        if (*fmt == '%') {\n            i64 = 0;\n            ui64 = 0;\n            zero = (u_char) ((*++fmt == '0') ? '0' : ' ');\n            width = 0;\n            sign = 1;\n            hex = 0;\n            max_width = 0;\n            frac_width = 0;\n            slen = (size_t) -1;\n            while (*fmt >= '0' && *fmt <= '9') {\n                width = width * 10 + *fmt++ - '0';\n            }\n            for ( ;; ) {\n                switch (*fmt) {\n                case 'u':\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case 'm':\n                    max_width = 1;\n                    fmt++;\n                    continue;\n                case 'X':\n                    hex = 2;\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case 'x':\n                    hex = 1;\n                    sign = 0;\n                    fmt++;\n                    continue;\n                case '.':\n                    fmt++;\n                    while (*fmt >= '0' && *fmt <= '9') {\n                        frac_width = frac_width * 10 + *fmt++ - '0';\n                    }\n                    break;\n                case '*':\n                    slen = va_arg(args, size_t);\n                    fmt++;\n                    continue;\n                default:\n                    break;\n                }\n                break;\n            }\n            switch (*fmt) {\n            case 'V':\n                v = va_arg(args, ngx_str_t *);\n                len = v->len;\n                len = (buf + len < last) ? len : (size_t) (last - buf);\n                buf = ngx_cpymem(buf, v->data, len);\n                fmt++;\n                continue;\n            case 'v':\n                vv = va_arg(args, ngx_variable_value_t *);\n                len = vv->len;\n                len = (buf + len < last) ? len : (size_t) (last - buf);\n                buf = ngx_cpymem(buf, vv->data, len);\n                fmt++;\n                continue;\n            case 's':\n                p = va_arg(args, u_char *);\n                if (slen == (size_t) -1) {\n                    while (*p && buf < last) {\n                        *buf++ = *p++;\n                    }\n                } else {\n                    len = (buf + slen < last) ? slen : (size_t) (last - buf);\n                    buf = ngx_cpymem(buf, p, len);\n                }\n                fmt++;\n                continue;\n            case 'O':\n                i64 = (int64_t) va_arg(args, off_t);\n                sign = 1;\n                break;\n            case 'P':\n                i64 = (int64_t) va_arg(args, ngx_pid_t);\n                sign = 1;\n                break;\n            case 'T':\n                i64 = (int64_t) va_arg(args, time_t);\n                sign = 1;\n                break;\n            case 'M':\n                ms = (ngx_msec_t) va_arg(args, ngx_msec_t);\n                if ((ngx_msec_int_t) ms == -1) {\n                    sign = 1;\n                    i64 = -1;\n                } else {\n                    sign = 0;\n                    ui64 = (uint64_t) ms;\n                }\n                break;\n            case 'z':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ssize_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, size_t);\n                }\n                break;\n            case 'i':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ngx_int_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, ngx_uint_t);\n                }\n                if (max_width) {\n                    width = NGX_INT_T_LEN;\n                }\n                break;\n            case 'd':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, int);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, u_int);\n                }\n                break;\n            case 'l':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, long);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, u_long);\n                }\n                break;\n            case 'D':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, int32_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, uint32_t);\n                }\n                break;\n            case 'L':\n                if (sign) {\n                    i64 = va_arg(args, int64_t);\n                } else {\n                    ui64 = va_arg(args, uint64_t);\n                }\n                break;\n            case 'A':\n                if (sign) {\n                    i64 = (int64_t) va_arg(args, ngx_atomic_int_t);\n                } else {\n                    ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);\n                }\n                if (max_width) {\n                    width = NGX_ATOMIC_T_LEN;\n                }\n                break;\n            case 'f':\n                f = (float) va_arg(args, double);\n                if (f < 0) {\n                    *buf++ = '-';\n                    f = -f;\n                }\n                ui64 = (int64_t) f;\n                buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);\n                if (frac_width) {\n                    if (buf < last) {\n                        *buf++ = '.';\n                    }\n                    scale = 1.0;\n                    for (i = 0; i < frac_width; i++) {\n                        scale *= 10.0;\n                    }\n                    ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);\n                    buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);\n                }\n                fmt++;\n                continue;\n#if !(NGX_WIN32)\n            case 'r':\n                i64 = (int64_t) va_arg(args, rlim_t);\n                sign = 1;\n                break;\n#endif\n            case 'p':\n                ui64 = (uintptr_t) va_arg(args, void *);\n                hex = 2;\n                sign = 0;\n                zero = '0';\n                width = NGX_PTR_SIZE * 2;\n                break;\n            case 'c':\n                d = va_arg(args, int);\n                *buf++ = (u_char) (d & 0xff);\n                fmt++;\n                continue;\n            case 'Z':\n                *buf++ = '\\0';\n                fmt++;\n                continue;\n            case 'N':\n#if (NGX_WIN32)\n                *buf++ = CR;\n#endif\n                *buf++ = LF;\n                fmt++;\n                continue;\n            case '%':\n                *buf++ = '%';\n                fmt++;\n                continue;\n            default:\n                *buf++ = *fmt++;\n                continue;\n            }\n            if (sign) {\n                if (i64 < 0) {\n                    *buf++ = '-';\n                    ui64 = (uint64_t) -i64;\n                } else {\n                    ui64 = (uint64_t) i64;\n                }\n            }\n            buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);\n            fmt++;\n        } else {\n            *buf++ = *fmt++;\n        }\n    }\n    return buf;\n}"]