Skip to content

Bug #63581 Possible null dereference and buffer overflow #234

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sapi/fpm/fpm/fpm_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ static int fpm_event_queue_del(struct fpm_event_queue_s **queue, struct fpm_even
}
if (q == *queue) {
*queue = q->next;
(*queue)->prev = NULL;
if (*queue) {
(*queue)->prev = NULL;
}
}

/* ask the event module to remove the fd from its own queue */
Expand Down Expand Up @@ -432,7 +434,9 @@ void fpm_event_loop(int err) /* {{{ */
}
if (q == fpm_event_queue_timer) {
fpm_event_queue_timer = q->next;
fpm_event_queue_timer->prev = NULL;
if (fpm_event_queue_timer) {
fpm_event_queue_timer->prev = NULL;
}
}
q = q->next;
free(q2);
Expand Down
7 changes: 4 additions & 3 deletions sapi/fpm/fpm/fpm_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int fpm_log_init_child(struct fpm_worker_pool_s *wp) /* {{{ */
int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
{
char *s, *b;
char buffer[FPM_LOG_BUFFER];
char buffer[FPM_LOG_BUFFER+1];
int token, test;
size_t len, len2;
struct fpm_scoreboard_proc_s proc, *proc_p;
Expand Down Expand Up @@ -146,9 +146,10 @@ int fpm_log_write(char *log_format TSRMLS_DC) /* {{{ */
s = log_format;

while (*s != '\0') {
if (len > FPM_LOG_BUFFER) {
/* Test is we have place for 1 more char. */
if (len >= FPM_LOG_BUFFER) {
zlog(ZLOG_NOTICE, "the log buffer is full (%d). The access log request has been truncated.", FPM_LOG_BUFFER);
len = FPM_LOG_BUFFER - 1;
len = FPM_LOG_BUFFER;
break;
}

Expand Down