src/http/ngx_http_core_module.c:1278: error: Null Dereference
  pointer `name` last assigned on line 1203 could be null and is dereferenced by call to `strncmp()` at line 1278, column 26.

src/http/ngx_http_core_module.c:1176:1: start of procedure ngx_http_core_try_files_phase()
1174. 
1175. 
1176. ngx_int_t
      ^
1177. ngx_http_core_try_files_phase(ngx_http_request_t *r,
1178.     ngx_http_phase_handler_t *ph)

src/http/ngx_http_core_module.c:1194:5: 
1192.                    "try files phase: %ui", r->phase_handler);
1193. 
1194.     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
          ^
1195. 
1196.     if (clcf->try_files == NULL) {

src/http/ngx_http_core_module.c:1196:9: Taking false branch
1194.     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
1195. 
1196.     if (clcf->try_files == NULL) {
              ^
1197.         r->phase_handler++;
1198.         return NGX_AGAIN;

src/http/ngx_http_core_module.c:1201:5: 
1199.     }
1200. 
1201.     allocated = 0;
          ^
1202.     root = 0;
1203.     name = NULL;

src/http/ngx_http_core_module.c:1202:5: 
1200. 
1201.     allocated = 0;
1202.     root = 0;
          ^
1203.     name = NULL;
1204.     /* suppress MSVC warning */

src/http/ngx_http_core_module.c:1203:5: 
1201.     allocated = 0;
1202.     root = 0;
1203.     name = NULL;
          ^
1204.     /* suppress MSVC warning */
1205.     path.data = NULL;

src/http/ngx_http_core_module.c:1205:5: 
1203.     name = NULL;
1204.     /* suppress MSVC warning */
1205.     path.data = NULL;
          ^
1206. 
1207.     tf = clcf->try_files;

src/http/ngx_http_core_module.c:1207:5: 
1205.     path.data = NULL;
1206. 
1207.     tf = clcf->try_files;
          ^
1208. 
1209.     alias = clcf->alias;

src/http/ngx_http_core_module.c:1209:5: 
1207.     tf = clcf->try_files;
1208. 
1209.     alias = clcf->alias;
          ^
1210. 
1211.     for ( ;; ) {

src/http/ngx_http_core_module.c:1380:5: Loop condition is true. Entering loop body
1378.         r->phase_handler++;
1379.         return NGX_AGAIN;
1380.     }
          ^
1381. 
1382.     /* not reached */

src/http/ngx_http_core_module.c:1213:13: Taking false branch
1211.     for ( ;; ) {
1212. 
1213.         if (tf->lengths) {
                  ^
1214.             ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
1215. 

src/http/ngx_http_core_module.c:1228:13: 
1226. 
1227.         } else {
1228.             len = tf->name.len;
                  ^
1229.         }
1230. 

src/http/ngx_http_core_module.c:1231:14: Taking false branch
1229.         }
1230. 
1231.         if (!alias) {
                   ^
1232.             reserve = len > r->uri.len ? len - r->uri.len : 0;
1233. 

src/http/ngx_http_core_module.c:1235:20: Taking false branch
1233. 
1234. #if (NGX_PCRE)
1235.         } else if (clcf->regex) {
                         ^
1236.             reserve = len;
1237. #endif

src/http/ngx_http_core_module.c:1240:23: Condition is false
1238. 
1239.         } else {
1240.             reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
                            ^
1241.         }
1242. 

src/http/ngx_http_core_module.c:1240:13: 
1238. 
1239.         } else {
1240.             reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
                  ^
1241.         }
1242. 

src/http/ngx_http_core_module.c:1243:13: Taking false branch
1241.         }
1242. 
1243.         if (reserve > allocated) {
                  ^
1244. 
1245.             /* 16 bytes are preallocation */

src/http/ngx_http_core_module.c:1256:13: Taking false branch
1254.          }
1255. 
1256.         if (tf->values == NULL) {
                  ^
1257. 
1258.             /* tf->name.len includes the terminating '\0' */

src/http/ngx_http_core_module.c:1265:13: 
1263. 
1264.         } else {
1265.             e.ip = tf->values->elts;
                  ^
1266.             e.pos = name;
1267.             e.flushed = 1;

src/http/ngx_http_core_module.c:1266:13: 
1264.         } else {
1265.             e.ip = tf->values->elts;
1266.             e.pos = name;
                  ^
1267.             e.flushed = 1;
1268. 

src/http/ngx_http_core_module.c:1267:13: 
1265.             e.ip = tf->values->elts;
1266.             e.pos = name;
1267.             e.flushed = 1;
                  ^
1268. 
1269.             while (*(uintptr_t *) e.ip) {

src/http/ngx_http_core_module.c:1269:20: Loop condition is true. Entering loop body
1267.             e.flushed = 1;
1268. 
1269.             while (*(uintptr_t *) e.ip) {
                         ^
1270.                 code = *(ngx_http_script_code_pt *) e.ip;
1271.                 code((ngx_http_script_engine_t *) &e);

src/http/ngx_http_core_module.c:1270:17: 
1268. 
1269.             while (*(uintptr_t *) e.ip) {
1270.                 code = *(ngx_http_script_code_pt *) e.ip;
                      ^
1271.                 code((ngx_http_script_engine_t *) &e);
1272.             }

src/http/ngx_http_core_module.c:1271:17: Skipping __function_pointer__(): unresolved function pointer
1269.             while (*(uintptr_t *) e.ip) {
1270.                 code = *(ngx_http_script_code_pt *) e.ip;
1271.                 code((ngx_http_script_engine_t *) &e);
                      ^
1272.             }
1273. 

src/http/ngx_http_core_module.c:1269:20: Loop condition is false. Leaving loop
1267.             e.flushed = 1;
1268. 
1269.             while (*(uintptr_t *) e.ip) {
                         ^
1270.                 code = *(ngx_http_script_code_pt *) e.ip;
1271.                 code((ngx_http_script_engine_t *) &e);

src/http/ngx_http_core_module.c:1274:13: 
1272.             }
1273. 
1274.             path.len = e.pos - path.data;
                  ^
1275. 
1276.             *e.pos = '\0';

src/http/ngx_http_core_module.c:1276:13: 
1274.             path.len = e.pos - path.data;
1275. 
1276.             *e.pos = '\0';
                  ^
1277. 
1278.             if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {

src/http/ngx_http_core_module.c:1278:17: Taking true branch
1276.             *e.pos = '\0';
1277. 
1278.             if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
                      ^
1279.                 ngx_memmove(name, name + alias, len - alias);
1280.                 path.len -= alias;

src/http/ngx_http_core_module.c:1278:26: 
1276.             *e.pos = '\0';
1277. 
1278.             if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
                               ^
1279.                 ngx_memmove(name, name + alias, len - alias);
1280.                 path.len -= alias;

ngx_int_t
ngx_http_core_try_files_phase(ngx_http_request_t *r,
    ngx_http_phase_handler_t *ph)
{
    size_t                        len, root, alias, reserve, allocated;
    u_char                       *p, *name;
    ngx_str_t                     path, args;
    ngx_uint_t                    test_dir;
    ngx_http_try_file_t          *tf;
    ngx_open_file_info_t          of;
    ngx_http_script_code_pt       code;
    ngx_http_script_engine_t      e;
    ngx_http_core_loc_conf_t     *clcf;
    ngx_http_script_len_code_pt   lcode;
    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                   "try files phase: %ui", r->phase_handler);
    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
    if (clcf->try_files == NULL) {
        r->phase_handler++;
        return NGX_AGAIN;
    }
    allocated = 0;
    root = 0;
    name = NULL;
    path.data = NULL;
    tf = clcf->try_files;
    alias = clcf->alias;
    for ( ;; ) {
        if (tf->lengths) {
            ngx_memzero(&e, sizeof(ngx_http_script_engine_t));
            e.ip = tf->lengths->elts;
            e.request = r;
            len = 1;
            while (*(uintptr_t *) e.ip) {
                lcode = *(ngx_http_script_len_code_pt *) e.ip;
                len += lcode(&e);
            }
        } else {
            len = tf->name.len;
        }
        if (!alias) {
            reserve = len > r->uri.len ? len - r->uri.len : 0;
#if (NGX_PCRE)
        } else if (clcf->regex) {
            reserve = len;
#endif
        } else {
            reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;
        }
        if (reserve > allocated) {
            allocated = reserve + 16;
            if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) {
                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
                return NGX_OK;
            }
            name = path.data + root;
         }
        if (tf->values == NULL) {
            ngx_memcpy(name, tf->name.data, tf->name.len);
            path.len = (name + tf->name.len - 1) - path.data;
        } else {
            e.ip = tf->values->elts;
            e.pos = name;
            e.flushed = 1;
            while (*(uintptr_t *) e.ip) {
                code = *(ngx_http_script_code_pt *) e.ip;
                code((ngx_http_script_engine_t *) &e);
            }
            path.len = e.pos - path.data;
            *e.pos = '\0';
            if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {
                ngx_memmove(name, name + alias, len - alias);
                path.len -= alias;
            }
        }
        test_dir = tf->test_dir;
        tf++;
        ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                       "trying to use %s: \"%s\" \"%s\"",
                       test_dir ? "dir" : "file", name, path.data);
        if (tf->lengths == NULL && tf->name.len == 0) {
            if (tf->code) {
                ngx_http_finalize_request(r, tf->code);
                return NGX_OK;
            }
            path.len -= root;
            path.data += root;
            if (path.data[0] == '@') {
                (void) ngx_http_named_location(r, &path);
            } else {
                ngx_http_split_args(r, &path, &args);
                (void) ngx_http_internal_redirect(r, &path, &args);
            }
            ngx_http_finalize_request(r, NGX_DONE);
            return NGX_OK;
        }
        ngx_memzero(&of, sizeof(ngx_open_file_info_t));
        of.read_ahead = clcf->read_ahead;
        of.directio = clcf->directio;
        of.valid = clcf->open_file_cache_valid;
        of.min_uses = clcf->open_file_cache_min_uses;
        of.test_only = 1;
        of.errors = clcf->open_file_cache_errors;
        of.events = clcf->open_file_cache_events;
        if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {
            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
            return NGX_OK;
        }
        if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)
            != NGX_OK)
        {
            if (of.err != NGX_ENOENT
                && of.err != NGX_ENOTDIR
                && of.err != NGX_ENAMETOOLONG)
            {
                ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,
                              "%s \"%s\" failed", of.failed, path.data);
            }
            continue;
        }
        if (of.is_dir && !test_dir) {
            continue;
        }
        path.len -= root;
        path.data += root;
        if (!alias) {
            r->uri = path;
#if (NGX_PCRE)
        } else if (clcf->regex) {
            if (!test_dir) {
                r->uri = path;
                r->add_uri_to_alias = 1;
            }
#endif
        } else {
            r->uri.len = alias + path.len;
            r->uri.data = ngx_pnalloc(r->pool, r->uri.len);
            if (r->uri.data == NULL) {
                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
                return NGX_OK;
            }
            p = ngx_copy(r->uri.data, clcf->name.data, alias);
            ngx_memcpy(p, name, path.len);
        }
        ngx_http_set_exten(r);
        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
                       "try file uri: \"%V\"", &r->uri);
        r->phase_handler++;
        return NGX_AGAIN;
    }
}
['ngx_int_t\nngx_http_core_try_files_phase(ngx_http_request_t *r,\n    ngx_http_phase_handler_t *ph)\n{\n    size_t                        len, root, alias, reserve, allocated;\n    u_char                       *p, *name;\n    ngx_str_t                     path, args;\n    ngx_uint_t                    test_dir;\n    ngx_http_try_file_t          *tf;\n    ngx_open_file_info_t          of;\n    ngx_http_script_code_pt       code;\n    ngx_http_script_engine_t      e;\n    ngx_http_core_loc_conf_t     *clcf;\n    ngx_http_script_len_code_pt   lcode;\n    ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,\n                   "try files phase: %ui", r->phase_handler);\n    clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);\n    if (clcf->try_files == NULL) {\n        r->phase_handler++;\n        return NGX_AGAIN;\n    }\n    allocated = 0;\n    root = 0;\n    name = NULL;\n    path.data = NULL;\n    tf = clcf->try_files;\n    alias = clcf->alias;\n    for ( ;; ) {\n        if (tf->lengths) {\n            ngx_memzero(&e, sizeof(ngx_http_script_engine_t));\n            e.ip = tf->lengths->elts;\n            e.request = r;\n            len = 1;\n            while (*(uintptr_t *) e.ip) {\n                lcode = *(ngx_http_script_len_code_pt *) e.ip;\n                len += lcode(&e);\n            }\n        } else {\n            len = tf->name.len;\n        }\n        if (!alias) {\n            reserve = len > r->uri.len ? len - r->uri.len : 0;\n#if (NGX_PCRE)\n        } else if (clcf->regex) {\n            reserve = len;\n#endif\n        } else {\n            reserve = len > r->uri.len - alias ? len - (r->uri.len - alias) : 0;\n        }\n        if (reserve > allocated) {\n            allocated = reserve + 16;\n            if (ngx_http_map_uri_to_path(r, &path, &root, allocated) == NULL) {\n                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);\n                return NGX_OK;\n            }\n            name = path.data + root;\n         }\n        if (tf->values == NULL) {\n            ngx_memcpy(name, tf->name.data, tf->name.len);\n            path.len = (name + tf->name.len - 1) - path.data;\n        } else {\n            e.ip = tf->values->elts;\n            e.pos = name;\n            e.flushed = 1;\n            while (*(uintptr_t *) e.ip) {\n                code = *(ngx_http_script_code_pt *) e.ip;\n                code((ngx_http_script_engine_t *) &e);\n            }\n            path.len = e.pos - path.data;\n            *e.pos = \'\\0\';\n            if (alias && ngx_strncmp(name, clcf->name.data, alias) == 0) {\n                ngx_memmove(name, name + alias, len - alias);\n                path.len -= alias;\n            }\n        }\n        test_dir = tf->test_dir;\n        tf++;\n        ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,\n                       "trying to use %s: \\"%s\\" \\"%s\\"",\n                       test_dir ? "dir" : "file", name, path.data);\n        if (tf->lengths == NULL && tf->name.len == 0) {\n            if (tf->code) {\n                ngx_http_finalize_request(r, tf->code);\n                return NGX_OK;\n            }\n            path.len -= root;\n            path.data += root;\n            if (path.data[0] == \'@\') {\n                (void) ngx_http_named_location(r, &path);\n            } else {\n                ngx_http_split_args(r, &path, &args);\n                (void) ngx_http_internal_redirect(r, &path, &args);\n            }\n            ngx_http_finalize_request(r, NGX_DONE);\n            return NGX_OK;\n        }\n        ngx_memzero(&of, sizeof(ngx_open_file_info_t));\n        of.read_ahead = clcf->read_ahead;\n        of.directio = clcf->directio;\n        of.valid = clcf->open_file_cache_valid;\n        of.min_uses = clcf->open_file_cache_min_uses;\n        of.test_only = 1;\n        of.errors = clcf->open_file_cache_errors;\n        of.events = clcf->open_file_cache_events;\n        if (ngx_http_set_disable_symlinks(r, clcf, &path, &of) != NGX_OK) {\n            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);\n            return NGX_OK;\n        }\n        if (ngx_open_cached_file(clcf->open_file_cache, &path, &of, r->pool)\n            != NGX_OK)\n        {\n            if (of.err != NGX_ENOENT\n                && of.err != NGX_ENOTDIR\n                && of.err != NGX_ENAMETOOLONG)\n            {\n                ngx_log_error(NGX_LOG_CRIT, r->connection->log, of.err,\n                              "%s \\"%s\\" failed", of.failed, path.data);\n            }\n            continue;\n        }\n        if (of.is_dir && !test_dir) {\n            continue;\n        }\n        path.len -= root;\n        path.data += root;\n        if (!alias) {\n            r->uri = path;\n#if (NGX_PCRE)\n        } else if (clcf->regex) {\n            if (!test_dir) {\n                r->uri = path;\n                r->add_uri_to_alias = 1;\n            }\n#endif\n        } else {\n            r->uri.len = alias + path.len;\n            r->uri.data = ngx_pnalloc(r->pool, r->uri.len);\n            if (r->uri.data == NULL) {\n                ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);\n                return NGX_OK;\n            }\n            p = ngx_copy(r->uri.data, clcf->name.data, alias);\n            ngx_memcpy(p, name, path.len);\n        }\n        ngx_http_set_exten(r);\n        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,\n                       "try file uri: \\"%V\\"", &r->uri);\n        r->phase_handler++;\n        return NGX_AGAIN;\n    }\n}']