The following issues were found
src/event/ngx_event_udp.c
2 issues
src/mail/ngx_mail_pop3_module.c
2 issues
Line: 188
CWE codes:
788
m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
m <<= 1, i++)
{
if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
continue;
}
if (m & conf->auth_methods) {
size += 1 + ngx_mail_pop3_auth_methods_names[i].len;
Reported by Cppcheck.
Line: 259
CWE codes:
788
m <= NGX_MAIL_AUTH_EXTERNAL_ENABLED;
m <<= 1, i++)
{
if (ngx_mail_pop3_auth_methods_names[i].len == 0) {
continue;
}
if (m & conf->auth_methods) {
size += ngx_mail_pop3_auth_methods_names[i].len
Reported by Cppcheck.
src/os/unix/ngx_daemon.c
2 issues
Line: 39
Column: 10
CWE codes:
362
umask(0);
fd = open("/dev/null", O_RDWR);
if (fd == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"open(\"/dev/null\") failed");
return NGX_ERROR;
}
Reported by FlawFinder.
Line: 37
Column: 5
CWE codes:
732
return NGX_ERROR;
}
umask(0);
fd = open("/dev/null", O_RDWR);
if (fd == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
"open(\"/dev/null\") failed");
Reported by FlawFinder.
src/os/unix/ngx_process_cycle.c
2 issues
Line: 889
Column: 5
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
}
tp = ngx_timeofday();
srandom(((unsigned) ngx_pid << 16) ^ tp->sec ^ tp->msec);
/*
* disable deleting previous events for the listening sockets because
* in the worker processes there are no events at all at this point
*/
Reported by FlawFinder.
Line: 964
Column: 25
CWE codes:
120
20
c = cycle->connections;
for (i = 0; i < cycle->connection_n; i++) {
if (c[i].fd != -1
&& c[i].read
&& !c[i].read->accept
&& !c[i].read->channel
&& !c[i].read->resolver)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
Reported by FlawFinder.
src/os/unix/ngx_time.c
2 issues
Line: 29
Column: 9
CWE codes:
807
20
Suggestion:
Check environment variables carefully before using them
{
#if (NGX_FREEBSD)
if (getenv("TZ")) {
return;
}
putenv("TZ=UTC");
Reported by FlawFinder.
Line: 44
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
#elif (NGX_LINUX)
time_t s;
struct tm *t;
char buf[4];
s = time(0);
t = localtime(&s);
Reported by FlawFinder.
src/os/unix/ngx_user.c
2 issues
Line: 25
Column: 13
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
cd.initialized = 0;
value = crypt_r((char *) key, (char *) salt, &cd);
if (value) {
len = ngx_strlen(value) + 1;
*encrypted = ngx_pnalloc(pool, len);
Reported by FlawFinder.
Line: 53
Column: 13
CWE codes:
327
Suggestion:
Use a different algorithm, such as SHA-256, with a larger, non-repeating salt
size_t len;
ngx_err_t err;
value = crypt((char *) key, (char *) salt);
if (value) {
len = ngx_strlen(value) + 1;
*encrypted = ngx_pnalloc(pool, len);
Reported by FlawFinder.
src/os/win32/ngx_udp_wsarecv.c
2 issues
Line: 32
Column: 14
CWE codes:
120
20
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
"WSARecv: fd:%d rc:%d %ul of %z", c->fd, rc, bytes, size);
rev = c->read;
if (rc == -1) {
rev->ready = 0;
err = ngx_socket_errno;
Reported by FlawFinder.
src/os/win32/ngx_win32_init.c
2 issues
Line: 276
Column: 5
CWE codes:
327
Suggestion:
Use a more secure technique for acquiring random values
}
tp = ngx_timeofday();
srand((ngx_pid << 16) ^ (unsigned) tp->sec ^ tp->msec);
return NGX_OK;
}
Reported by FlawFinder.
Line: 20
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
ngx_uint_t ngx_inherited_nonblocking = 1;
ngx_uint_t ngx_tcp_nodelay_and_tcp_nopush;
char ngx_unique[NGX_INT32_LEN + 1];
ngx_os_io_t ngx_os_io = {
ngx_wsarecv,
ngx_wsarecv_chain,
Reported by FlawFinder.
src/os/win32/ngx_wsarecv.c
2 issues
Line: 33
Column: 14
CWE codes:
120
20
ngx_log_debug4(NGX_LOG_DEBUG_EVENT, c->log, 0,
"WSARecv: fd:%d rc:%d %ul of %z", c->fd, rc, bytes, size);
rev = c->read;
if (rc == -1) {
rev->ready = 0;
err = ngx_socket_errno;
Reported by FlawFinder.
Line: 116
Column: 14
CWE codes:
120
20
ngx_event_t *rev;
LPWSAOVERLAPPED ovlp;
rev = c->read;
if (!rev->ready) {
ngx_log_error(NGX_LOG_ALERT, c->log, 0, "second wsa post");
return NGX_AGAIN;
}
Reported by FlawFinder.
src/http/modules/ngx_http_geo_module.c
1 issues
Line: 469
CWE codes:
562
save = *cf;
cf->pool = pool;
cf->ctx = &ctx;
cf->handler = ngx_http_geo;
cf->handler_conf = conf;
rv = ngx_conf_parse(cf, NULL);
Reported by Cppcheck.