The following issues were found
src/event/ngx_event_openssl.c
24 issues
Line: 1985
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static void
ngx_ssl_handshake_log(ngx_connection_t *c)
{
char buf[129], *s, *d;
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
const
#endif
SSL_CIPHER *cipher;
Reported by FlawFinder.
Line: 5355
Column: 28
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
value = cf->args->elts;
engine = ENGINE_by_id((char *) value[1].data);
if (engine == NULL) {
ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
"ENGINE_by_id(\"%V\") failed", &value[1]);
return NGX_CONF_ERROR;
Reported by FlawFinder.
Line: 1734
Column: 38
CWE codes:
120
20
if (n == 1) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 1793
Column: 38
CWE codes:
120
20
c->read->handler = ngx_ssl_handshake_handler;
c->write->handler = ngx_ssl_handshake_handler;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 1809
Column: 38
CWE codes:
120
20
c->read->handler = ngx_ssl_handshake_handler;
c->write->handler = ngx_ssl_handshake_handler;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 1875
Column: 38
CWE codes:
120
20
if (n == SSL_READ_EARLY_DATA_SUCCESS) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 1930
Column: 38
CWE codes:
120
20
c->read->handler = ngx_ssl_handshake_handler;
c->write->handler = ngx_ssl_handshake_handler;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 1946
Column: 38
CWE codes:
120
20
c->read->handler = ngx_ssl_handshake_handler;
c->write->handler = ngx_ssl_handshake_handler;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
Reported by FlawFinder.
Line: 2189
Column: 43
CWE codes:
120
20
ngx_delete_posted_event(c->read);
}
ngx_post_event(c->read, &ngx_posted_next_events);
}
ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
"SSL_read: avail:%d", c->read->available);
Reported by FlawFinder.
src/core/ngx_file.c
22 issues
Line: 632
Column: 17
CWE codes:
362
Suggestion:
Use fchown( ) instead
}
if (fi.st_uid != user) {
if (chown((const char *) path[i]->name.data, user, -1) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"chown(\"%s\", %d) failed",
path[i]->name.data, user);
return NGX_ERROR;
}
Reported by FlawFinder.
Line: 645
Column: 17
CWE codes:
362
Suggestion:
Use fchmod( ) instead
{
fi.st_mode |= (S_IRUSR|S_IWUSR|S_IXUSR);
if (chmod((const char *) path[i]->name.data, fi.st_mode) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
"chmod() \"%s\" failed", path[i]->name.data);
return NGX_ERROR;
}
}
Reported by FlawFinder.
Line: 115
Column: 66
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
if (tf->file.fd == NGX_INVALID_FILE) {
rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
tf->persistent, tf->clean, tf->access);
if (rc != NGX_OK) {
return rc;
}
Reported by FlawFinder.
Line: 142
Column: 57
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_int_t
ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
ngx_uint_t persistent, ngx_uint_t clean, ngx_uint_t access)
{
size_t levels;
u_char *p;
uint32_t n;
ngx_err_t err;
Reported by FlawFinder.
Line: 202
Column: 67
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
"hashed path: %s", file->name.data);
file->fd = ngx_open_tempfile(file->name.data, persistent, access);
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
"temp fd:%d", file->fd);
if (file->fd != NGX_INVALID_FILE) {
Reported by FlawFinder.
Line: 304
Column: 46
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_err_t
ngx_create_full_path(u_char *dir, ngx_uint_t access)
{
u_char *p, ch;
ngx_err_t err;
err = 0;
Reported by FlawFinder.
Line: 326
Column: 33
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
*p = '\0';
if (ngx_create_dir(dir, access) == NGX_FILE_ERROR) {
err = ngx_errno;
switch (err) {
case NGX_EEXIST:
err = 0;
Reported by FlawFinder.
Line: 466
Column: 36
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
u_char *p;
ngx_str_t *value;
ngx_uint_t i, right, shift, *access, user;
access = (ngx_uint_t *) (confp + cmd->offset);
if (*access != NGX_CONF_UNSET_UINT) {
return "is duplicate";
Reported by FlawFinder.
Line: 470
Column: 10
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
access = (ngx_uint_t *) (confp + cmd->offset);
if (*access != NGX_CONF_UNSET_UINT) {
return "is duplicate";
}
value = cf->args->elts;
Reported by FlawFinder.
Line: 510
Column: 10
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
goto invalid;
}
*access |= right << shift;
}
*access |= user;
return NGX_CONF_OK;
Reported by FlawFinder.
src/mail/ngx_mail_proxy_module.c
20 issues
Line: 162
Column: 43
CWE codes:
120
20
return;
}
ngx_add_timer(p->upstream.connection->read, cscf->timeout);
p->upstream.connection->data = s;
p->upstream.connection->pool = s->connection->pool;
s->connection->read->handler = ngx_mail_proxy_block_read;
Reported by FlawFinder.
Line: 253
Column: 38
CWE codes:
120
20
if (s->proxy->proxy_protocol) {
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "mail proxy pop3 busy");
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_proxy_internal_server_error(s);
return;
}
return;
Reported by FlawFinder.
Line: 264
Column: 38
CWE codes:
120
20
rc = ngx_mail_proxy_read_response(s, 0);
if (rc == NGX_AGAIN) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_proxy_internal_server_error(s);
return;
}
return;
Reported by FlawFinder.
Line: 324
Column: 38
CWE codes:
120
20
c->write->handler = ngx_mail_proxy_handler;
pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module);
ngx_add_timer(s->connection->read, pcf->timeout);
ngx_del_timer(c->read);
c->log->action = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
Reported by FlawFinder.
Line: 325
Column: 26
CWE codes:
120
20
pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module);
ngx_add_timer(s->connection->read, pcf->timeout);
ngx_del_timer(c->read);
c->log->action = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
if (s->buffer->pos < s->buffer->last) {
Reported by FlawFinder.
Line: 354
Column: 34
CWE codes:
120
20
return;
}
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_proxy_internal_server_error(s);
return;
}
s->proxy->buffer->pos = s->proxy->buffer->start;
Reported by FlawFinder.
Line: 391
Column: 38
CWE codes:
120
20
if (s->proxy->proxy_protocol) {
ngx_log_debug0(NGX_LOG_DEBUG_MAIL, c->log, 0, "mail proxy imap busy");
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_proxy_internal_server_error(s);
return;
}
return;
Reported by FlawFinder.
Line: 402
Column: 38
CWE codes:
120
20
rc = ngx_mail_proxy_read_response(s, s->mail_state);
if (rc == NGX_AGAIN) {
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_mail_proxy_internal_server_error(s);
return;
}
return;
Reported by FlawFinder.
Line: 483
Column: 38
CWE codes:
120
20
c->write->handler = ngx_mail_proxy_handler;
pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module);
ngx_add_timer(s->connection->read, pcf->timeout);
ngx_del_timer(c->read);
c->log->action = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
Reported by FlawFinder.
Line: 484
Column: 26
CWE codes:
120
20
pcf = ngx_mail_get_module_srv_conf(s, ngx_mail_proxy_module);
ngx_add_timer(s->connection->read, pcf->timeout);
ngx_del_timer(c->read);
c->log->action = NULL;
ngx_log_error(NGX_LOG_INFO, c->log, 0, "client logged in");
if (s->buffer->pos < s->buffer->last) {
Reported by FlawFinder.
src/http/ngx_http_upstream.c
17 issues
Line: 4169
Column: 65
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
tf->persistent = 1;
if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
tf->persistent, tf->clean, tf->access)
!= NGX_OK)
{
return;
}
Reported by FlawFinder.
Line: 1322
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
ngx_event_t *ev)
{
int n;
char buf[1];
ngx_err_t err;
ngx_int_t event;
ngx_connection_t *c;
ngx_http_upstream_t *u;
Reported by FlawFinder.
Line: 614
Column: 43
CWE codes:
120
20
if (!u->store && !r->post_action && !u->conf->ignore_client_abort) {
if (r->connection->read->ready) {
ngx_post_event(r->connection->read, &ngx_posted_events);
} else {
if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
Reported by FlawFinder.
Line: 617
Column: 54
CWE codes:
120
20
ngx_post_event(r->connection->read, &ngx_posted_events);
} else {
if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
}
Reported by FlawFinder.
Line: 1306
Column: 65
CWE codes:
120
20
static void
ngx_http_upstream_rd_check_broken_connection(ngx_http_request_t *r)
{
ngx_http_upstream_check_broken_connection(r, r->connection->read);
}
static void
ngx_http_upstream_wr_check_broken_connection(ngx_http_request_t *r)
Reported by FlawFinder.
Line: 2418
Column: 42
CWE codes:
120
20
ngx_add_timer(rev, u->read_timeout);
#endif
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u,
NGX_HTTP_INTERNAL_SERVER_ERROR);
return;
}
Reported by FlawFinder.
Line: 3351
Column: 27
CWE codes:
120
20
if (u->peer.connection->read->ready
|| u->buffer.pos != u->buffer.last)
{
ngx_post_event(c->read, &ngx_posted_events);
ngx_http_upstream_process_upgraded(r, 1, 1);
return;
}
ngx_http_upstream_process_upgraded(r, 0, 1);
Reported by FlawFinder.
Line: 3543
Column: 41
CWE codes:
120
20
flags = 0;
}
if (ngx_handle_read_event(upstream->read, flags) != NGX_OK) {
ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
return;
}
if (upstream->read->active && !upstream->read->ready) {
Reported by FlawFinder.
src/http/v2/ngx_http_v2.c
16 issues
Line: 680
Column: 26
CWE codes:
120
20
ngx_http_core_module);
if (!c->read->timer_set) {
ngx_add_timer(c->read, clcf->keepalive_timeout);
}
ngx_reusable_connection(c, 1);
if (h2c->state.incomplete) {
Reported by FlawFinder.
Line: 753
Column: 14
CWE codes:
120
20
}
#endif
rev = c->read;
rev->handler = ngx_http_v2_lingering_close_handler;
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
ngx_http_close_connection(c);
return;
Reported by FlawFinder.
Line: 2653
Column: 30
CWE codes:
120
20
if (h2c->state.stream) {
r = h2c->state.stream->request;
rev = r->connection->read;
if (!rev->timer_set) {
cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module);
ngx_add_timer(rev, cscf->client_header_timeout);
}
Reported by FlawFinder.
Line: 4133
Column: 38
CWE codes:
120
20
}
if (!buf) {
ngx_add_timer(r->connection->read, clcf->client_body_timeout);
}
r->read_event_handler = ngx_http_v2_read_client_request_body_handler;
r->write_event_handler = ngx_http_request_empty_handler;
Reported by FlawFinder.
Line: 4181
Column: 31
CWE codes:
120
20
rb->rest = 0;
if (fc->read->timer_set) {
ngx_del_timer(fc->read);
}
if (r->request_body_no_buffering) {
ngx_post_event(fc->read, &ngx_posted_events);
return NGX_OK;
Reported by FlawFinder.
Line: 4215
Column: 23
CWE codes:
120
20
}
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
ngx_add_timer(fc->read, clcf->client_body_timeout);
if (r->request_body_no_buffering) {
ngx_post_event(fc->read, &ngx_posted_events);
return NGX_OK;
}
Reported by FlawFinder.
src/os/unix/ngx_files.h
14 issues
Line: 165
Column: 38
CWE codes:
362
Suggestion:
Use fchmod( ) instead
#define ngx_rename_file_n "rename()"
#define ngx_change_file_access(n, a) chmod((const char *) n, a)
#define ngx_change_file_access_n "chmod()"
ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s);
#define ngx_set_file_time_n "utimes()"
Reported by FlawFinder.
Line: 60
Column: 43
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#define NGX_HAVE_CASELESS_FILESYSTEM 1
#endif
#define ngx_open_file(name, mode, create, access) \
open((const char *) name, mode|create|O_BINARY, access)
#else
#define ngx_open_file(name, mode, create, access) \
Reported by FlawFinder.
Line: 61
Column: 53
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#endif
#define ngx_open_file(name, mode, create, access) \
open((const char *) name, mode|create|O_BINARY, access)
#else
#define ngx_open_file(name, mode, create, access) \
open((const char *) name, mode|create, access)
Reported by FlawFinder.
Line: 65
Column: 43
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#else
#define ngx_open_file(name, mode, create, access) \
open((const char *) name, mode|create, access)
#endif
#define ngx_open_file_n "open()"
Reported by FlawFinder.
Line: 66
Column: 44
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#else
#define ngx_open_file(name, mode, create, access) \
open((const char *) name, mode|create, access)
#endif
#define ngx_open_file_n "open()"
Reported by FlawFinder.
Line: 118
Column: 16
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent,
ngx_uint_t access);
#define ngx_open_tempfile_n "open()"
ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset);
#if (NGX_HAVE_PREAD)
Reported by FlawFinder.
Line: 231
Column: 65
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#define ngx_read_dir_n "readdir()"
#define ngx_create_dir(name, access) mkdir((const char *) name, access)
#define ngx_create_dir_n "mkdir()"
#define ngx_delete_dir(name) rmdir((const char *) name)
#define ngx_delete_dir_n "rmdir()"
Reported by FlawFinder.
Line: 231
Column: 30
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#define ngx_read_dir_n "readdir()"
#define ngx_create_dir(name, access) mkdir((const char *) name, access)
#define ngx_create_dir_n "mkdir()"
#define ngx_delete_dir(name) rmdir((const char *) name)
#define ngx_delete_dir_n "rmdir()"
Reported by FlawFinder.
Line: 357
Column: 49
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#if (NGX_HAVE_OPENAT)
#define ngx_openat_file(fd, name, mode, create, access) \
openat(fd, (const char *) name, mode|create, access)
#define ngx_openat_file_n "openat()"
#define ngx_file_at_info(fd, name, sb, flag) \
Reported by FlawFinder.
Line: 358
Column: 50
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#if (NGX_HAVE_OPENAT)
#define ngx_openat_file(fd, name, mode, create, access) \
openat(fd, (const char *) name, mode|create, access)
#define ngx_openat_file_n "openat()"
#define ngx_file_at_info(fd, name, sb, flag) \
fstatat(fd, (const char *) name, sb, flag)
Reported by FlawFinder.
src/http/ngx_http_request.c
13 issues
Line: 2942
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
ngx_http_test_reading(ngx_http_request_t *r)
{
int n;
char buf[1];
ngx_err_t err;
ngx_event_t *rev;
ngx_connection_t *c;
c = r->connection;
Reported by FlawFinder.
Line: 324
Column: 14
CWE codes:
120
20
c->log_error = NGX_ERROR_INFO;
rev = c->read;
rev->handler = ngx_http_wait_request_handler;
c->write->handler = ngx_http_empty_handler;
#if (NGX_HTTP_V2)
if (hc->addr_conf->http2) {
Reported by FlawFinder.
Line: 2757
Column: 42
CWE codes:
120
20
if (r->discard_body) {
r->read_event_handler = ngx_http_discarded_request_body_handler;
ngx_add_timer(r->connection->read, clcf->lingering_timeout);
if (r->lingering_time == 0) {
r->lingering_time = ngx_time()
+ (time_t) (clcf->lingering_time / 1000);
}
Reported by FlawFinder.
Line: 2931
Column: 42
CWE codes:
120
20
if ((ngx_event_flags & NGX_USE_LEVEL_EVENT)
&& r->connection->read->active)
{
if (ngx_del_event(r->connection->read, NGX_READ_EVENT, 0) != NGX_OK) {
ngx_http_close_request(r, 0);
}
}
}
Reported by FlawFinder.
src/os/win32/ngx_process_cycle.c
12 issues
Line: 770
Column: 5
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
ngx_cycle_t *cycle;
tp = ngx_timeofday();
srand((ngx_pid << 16) ^ (unsigned) tp->sec ^ tp->msec);
cycle = (ngx_cycle_t *) ngx_cycle;
for (n = 0; cycle->modules[n]; n++) {
if (cycle->modules[n]->init_process) {
Reported by FlawFinder.
Line: 47
Column: 1
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
HANDLE ngx_master_process_event;
char ngx_master_process_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_stop_event;
static char ngx_stop_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_quit_event;
static char ngx_quit_event_name[NGX_PROCESS_SYNC_NAME];
Reported by FlawFinder.
Line: 50
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
char ngx_master_process_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_stop_event;
static char ngx_stop_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_quit_event;
static char ngx_quit_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reopen_event;
static char ngx_reopen_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reload_event;
Reported by FlawFinder.
Line: 52
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static HANDLE ngx_stop_event;
static char ngx_stop_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_quit_event;
static char ngx_quit_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reopen_event;
static char ngx_reopen_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reload_event;
static char ngx_reload_event_name[NGX_PROCESS_SYNC_NAME];
Reported by FlawFinder.
Line: 54
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static HANDLE ngx_quit_event;
static char ngx_quit_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reopen_event;
static char ngx_reopen_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reload_event;
static char ngx_reload_event_name[NGX_PROCESS_SYNC_NAME];
HANDLE ngx_cache_manager_mutex;
char ngx_cache_manager_mutex_name[NGX_PROCESS_SYNC_NAME];
Reported by FlawFinder.
Line: 56
Column: 8
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static HANDLE ngx_reopen_event;
static char ngx_reopen_event_name[NGX_PROCESS_SYNC_NAME];
static HANDLE ngx_reload_event;
static char ngx_reload_event_name[NGX_PROCESS_SYNC_NAME];
HANDLE ngx_cache_manager_mutex;
char ngx_cache_manager_mutex_name[NGX_PROCESS_SYNC_NAME];
HANDLE ngx_cache_manager_event;
Reported by FlawFinder.
Line: 59
Column: 1
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static char ngx_reload_event_name[NGX_PROCESS_SYNC_NAME];
HANDLE ngx_cache_manager_mutex;
char ngx_cache_manager_mutex_name[NGX_PROCESS_SYNC_NAME];
HANDLE ngx_cache_manager_event;
void
ngx_master_process_cycle(ngx_cycle_t *cycle)
Reported by FlawFinder.
Line: 572
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
static void
ngx_worker_process_cycle(ngx_cycle_t *cycle, char *mevn)
{
char wtevn[NGX_PROCESS_SYNC_NAME];
char wqevn[NGX_PROCESS_SYNC_NAME];
char wroevn[NGX_PROCESS_SYNC_NAME];
HANDLE mev, events[3];
u_long nev, ev;
ngx_err_t err;
Reported by FlawFinder.
Line: 573
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
ngx_worker_process_cycle(ngx_cycle_t *cycle, char *mevn)
{
char wtevn[NGX_PROCESS_SYNC_NAME];
char wqevn[NGX_PROCESS_SYNC_NAME];
char wroevn[NGX_PROCESS_SYNC_NAME];
HANDLE mev, events[3];
u_long nev, ev;
ngx_err_t err;
ngx_tid_t wtid, cmtid, cltid;
Reported by FlawFinder.
Line: 574
Column: 5
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
char wtevn[NGX_PROCESS_SYNC_NAME];
char wqevn[NGX_PROCESS_SYNC_NAME];
char wroevn[NGX_PROCESS_SYNC_NAME];
HANDLE mev, events[3];
u_long nev, ev;
ngx_err_t err;
ngx_tid_t wtid, cmtid, cltid;
ngx_log_t *log;
Reported by FlawFinder.
src/http/modules/ngx_http_dav_module.c
10 issues
Line: 23
Column: 17
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
typedef struct {
ngx_uint_t methods;
ngx_uint_t access;
ngx_uint_t min_delete_depth;
ngx_flag_t create_full_put_path;
} ngx_http_dav_loc_conf_t;
Reported by FlawFinder.
Line: 104
Column: 41
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
ngx_conf_set_access_slot,
NGX_HTTP_LOC_CONF_OFFSET,
offsetof(ngx_http_dav_loc_conf_t, access),
NULL },
ngx_null_command
};
Reported by FlawFinder.
Line: 265
Column: 24
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
ext.access = dlcf->access;
ext.path_access = dlcf->access;
ext.time = -1;
ext.create_path = dlcf->create_full_put_path;
ext.delete_file = 1;
ext.log = r->connection->log;
Reported by FlawFinder.
Line: 266
Column: 29
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
ext.access = dlcf->access;
ext.path_access = dlcf->access;
ext.time = -1;
ext.create_path = dlcf->create_full_put_path;
ext.delete_file = 1;
ext.log = r->connection->log;
Reported by FlawFinder.
Line: 520
Column: 56
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
"http mkcol path: \"%s\"", path.data);
if (ngx_create_dir(path.data, ngx_dir_access(dlcf->access))
!= NGX_FILE_ERROR)
{
if (ngx_http_dav_location(r) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
Reported by FlawFinder.
Line: 832
Column: 37
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
ext.access = 0;
ext.path_access = dlcf->access;
ext.time = -1;
ext.create_path = 1;
ext.delete_file = 0;
ext.log = r->connection->log;
Reported by FlawFinder.
Line: 885
Column: 49
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ctx->log, 0,
"http copy dir to: \"%s\"", dir);
if (ngx_create_dir(dir, ngx_dir_access(ctx->access)) == NGX_FILE_ERROR) {
(void) ngx_http_dav_error(ctx->log, ngx_errno, 0, ngx_create_dir_n,
dir);
}
ngx_free(dir);
Reported by FlawFinder.
Line: 988
Column: 22
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
cf.size = ctx->size;
cf.buf_size = 0;
cf.access = ctx->access;
cf.time = ctx->mtime;
cf.log = ctx->log;
(void) ngx_copy_file(path->data, file, &cf);
Reported by FlawFinder.
Line: 1147
Column: 37
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_conf_merge_uint_value(conf->min_delete_depth,
prev->min_delete_depth, 0);
ngx_conf_merge_uint_value(conf->access, prev->access, 0600);
ngx_conf_merge_value(conf->create_full_put_path,
prev->create_full_put_path, 0);
return NGX_CONF_OK;
Reported by FlawFinder.
Line: 1147
Column: 51
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_conf_merge_uint_value(conf->min_delete_depth,
prev->min_delete_depth, 0);
ngx_conf_merge_uint_value(conf->access, prev->access, 0600);
ngx_conf_merge_value(conf->create_full_put_path,
prev->create_full_put_path, 0);
return NGX_CONF_OK;
Reported by FlawFinder.
src/core/ngx_open_file_cache.c
10 issues
Line: 27
Column: 49
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
static void ngx_open_file_cache_cleanup(void *data);
#if (NGX_HAVE_OPENAT)
static ngx_fd_t ngx_openat_file_owner(ngx_fd_t at_fd, const u_char *name,
ngx_int_t mode, ngx_int_t create, ngx_int_t access, ngx_log_t *log);
#if (NGX_HAVE_O_PATH)
static ngx_int_t ngx_file_o_path_info(ngx_fd_t fd, ngx_file_info_t *fi,
ngx_log_t *log);
#endif
#endif
Reported by FlawFinder.
Line: 35
Column: 15
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#endif
static ngx_fd_t ngx_open_file_wrapper(ngx_str_t *name,
ngx_open_file_info_t *of, ngx_int_t mode, ngx_int_t create,
ngx_int_t access, ngx_log_t *log);
static ngx_int_t ngx_file_info_wrapper(ngx_str_t *name,
ngx_open_file_info_t *of, ngx_file_info_t *fi, ngx_log_t *log);
static ngx_int_t ngx_open_and_stat_file(ngx_str_t *name,
ngx_open_file_info_t *of, ngx_log_t *log);
static void ngx_open_file_add_event(ngx_open_file_cache_t *cache,
Reported by FlawFinder.
Line: 493
Column: 49
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
static ngx_fd_t
ngx_openat_file_owner(ngx_fd_t at_fd, const u_char *name,
ngx_int_t mode, ngx_int_t create, ngx_int_t access, ngx_log_t *log)
{
ngx_fd_t fd;
ngx_err_t err;
ngx_file_info_t fi, atfi;
Reported by FlawFinder.
Line: 511
Column: 53
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
* symlink during openat() or not).
*/
fd = ngx_openat_file(at_fd, name, mode, create, access);
if (fd == NGX_INVALID_FILE) {
return NGX_INVALID_FILE;
}
Reported by FlawFinder.
Line: 615
Column: 49
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
static ngx_fd_t
ngx_open_file_wrapper(ngx_str_t *name, ngx_open_file_info_t *of,
ngx_int_t mode, ngx_int_t create, ngx_int_t access, ngx_log_t *log)
{
ngx_fd_t fd;
#if !(NGX_HAVE_OPENAT)
Reported by FlawFinder.
Line: 621
Column: 50
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
#if !(NGX_HAVE_OPENAT)
fd = ngx_open_file(name->data, mode, create, access);
if (fd == NGX_INVALID_FILE) {
of->err = ngx_errno;
of->failed = ngx_open_file_n;
return NGX_INVALID_FILE;
Reported by FlawFinder.
Line: 638
Column: 54
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
ngx_str_t at_name;
if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_OFF) {
fd = ngx_open_file(name->data, mode, create, access);
if (fd == NGX_INVALID_FILE) {
of->err = ngx_errno;
of->failed = ngx_open_file_n;
return NGX_INVALID_FILE;
Reported by FlawFinder.
Line: 748
Column: 56
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
* reopening a directory, we don't depend on it at all.
*/
fd = ngx_openat_file(at_fd, ".", mode, create, access);
goto done;
}
if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_NOTOWNER
&& !(create & (NGX_FILE_CREATE_OR_OPEN|NGX_FILE_TRUNCATE)))
Reported by FlawFinder.
Line: 755
Column: 60
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
if (of->disable_symlinks == NGX_DISABLE_SYMLINKS_NOTOWNER
&& !(create & (NGX_FILE_CREATE_OR_OPEN|NGX_FILE_TRUNCATE)))
{
fd = ngx_openat_file_owner(at_fd, p, mode, create, access, log);
} else {
fd = ngx_openat_file(at_fd, p, mode|NGX_FILE_NOFOLLOW, create, access);
}
Reported by FlawFinder.
Line: 758
Column: 72
CWE codes:
362/367!
Suggestion:
Set up the correct permissions (e.g., using setuid()) and try to open the file directly
fd = ngx_openat_file_owner(at_fd, p, mode, create, access, log);
} else {
fd = ngx_openat_file(at_fd, p, mode|NGX_FILE_NOFOLLOW, create, access);
}
done:
if (fd == NGX_INVALID_FILE) {
Reported by FlawFinder.