Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit607dfd2

Browse files
Ewald DieterichFelipe Zimmerle
Ewald Dieterich
authored and
Felipe Zimmerle
committed
Fix segmentation fault if writing to audit log fails
A segmentation fault occurs if concurrent audit log format is enabled(SecAuditLogType Concurrent) and writing to the log fails.
1 parent5342f36 commit607dfd2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

‎apache2/msc_logging.c‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,18 @@ static int sec_auditlog_write(modsec_rec *msr, const char *data, unsigned int le
5252
msr_log(msr,1,"Audit log: Failed writing (requested %"APR_SIZE_T_FMT
5353
" bytes, written %"APR_SIZE_T_FMT")",nbytes,nbytes_written);
5454

55+
/* Concurrent log format: Don't leak file handle. */
56+
if (msr->txcfg->auditlog_type==AUDITLOG_CONCURRENT) {
57+
apr_file_close(msr->new_auditlog_fd);
58+
}
59+
5560
/* Set to NULL to prevent more than one error message on
5661
* out-of-disk-space events and to prevent further attempts
5762
* to write to the same file in this request.
5863
*
59-
* Note that, as we opened the file through the pool mechanism of
60-
* the APR, we do not need to close the file here. It will be closed
61-
* automatically at the end of the request.
64+
*Serial log format:Note that, as we opened the file through the
65+
*pool mechanism ofthe APR, we do not need to close the file
66+
*here. It will be closedautomatically at the end of the request.
6267
*/
6368
msr->new_auditlog_fd=NULL;
6469

@@ -1181,7 +1186,10 @@ void sec_audit_logger(modsec_rec *msr) {
11811186

11821187
/* From here on only concurrent-style processing. */
11831188

1184-
apr_file_close(msr->new_auditlog_fd);
1189+
/* File handle might already be closed after write failure. */
1190+
if (msr->new_auditlog_fd) {
1191+
apr_file_close(msr->new_auditlog_fd);
1192+
}
11851193

11861194
/* Write an entry to the index file */
11871195

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp