Skip to content

Commit a249574

Browse files
author
Felipe Zimmerle
committed
Avoids to flush xml buffer while assembling the injected html
Fix #742
1 parent 72f632e commit a249574

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
DD MMM YYYY - 2.9.2 - To be released
22
------------------------------------
33

4+
* Avoid to flush xml buffer while assembling the injected html.
5+
[Issue #742 - @zimmerle]
46
* Avoid additional operator invokation if last transform of a multimatch
57
doesn't modify the input
68
[Issue #1086, #1087 - Daniel Stelter-Gliese]

apache2/msc_crypt.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,7 +1072,8 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
10721072
}
10731073

10741074
htmlDocContentDumpFormatOutput(output_buf, msr->crypto_html_tree, NULL, 0);
1075-
xmlOutputBufferFlush(output_buf);
1075+
// Not necessary in 2.9.4+
1076+
//xmlOutputBufferFlush(output_buf);
10761077

10771078
#ifdef LIBXML2_NEW_BUFFER
10781079

@@ -1082,6 +1083,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
10821083
xmlOutputBufferClose(output_buf);
10831084
xmlFreeDoc(msr->crypto_html_tree);
10841085
msr->of_stream_changed = 0;
1086+
msr_log(msr, 4, "inject_hashed_response_body: NEW_BUFFER Output buffer is null.");
10851087
return -1;
10861088
}
10871089

@@ -1096,6 +1098,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
10961098
if (msr->stream_output_data == NULL) {
10971099
xmlOutputBufferClose(output_buf);
10981100
xmlFreeDoc(msr->crypto_html_tree);
1101+
msr_log(msr, 4, "inject_hashed_response_body: NEW BUFFER Stream Output is null.");
10991102
return -1;
11001103
}
11011104

@@ -1111,6 +1114,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11111114
xmlOutputBufferClose(output_buf);
11121115
xmlFreeDoc(msr->crypto_html_tree);
11131116
msr->of_stream_changed = 0;
1117+
msr_log(msr, 4, "inject_hashed_response_body: Conv is null.");
11141118
return -1;
11151119
}
11161120

@@ -1123,6 +1127,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11231127
msr->stream_output_data = (char *)malloc(msr->stream_output_length+1);
11241128

11251129
if (msr->stream_output_data == NULL) {
1130+
msr_log(msr, 4, "inject_hashed_response_body: Stream Output data is NULL.");
11261131
xmlOutputBufferClose(output_buf);
11271132
xmlFreeDoc(msr->crypto_html_tree);
11281133
return -1;
@@ -1143,6 +1148,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11431148
if(output_buf->buffer == NULL || output_buf->buffer->use == 0) {
11441149
xmlOutputBufferClose(output_buf);
11451150
xmlFreeDoc(msr->crypto_html_tree);
1151+
msr_log(msr, 4, "inject_hashed_response_body: Output buffer is null.");
11461152
msr->of_stream_changed = 0;
11471153
return -1;
11481154
}
@@ -1158,6 +1164,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11581164
if (msr->stream_output_data == NULL) {
11591165
xmlOutputBufferClose(output_buf);
11601166
xmlFreeDoc(msr->crypto_html_tree);
1167+
msr_log(msr, 4, "inject_hashed_response_body: Stream Output is null.");
11611168
return -1;
11621169
}
11631170

@@ -1174,6 +1181,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11741181
xmlOutputBufferClose(output_buf);
11751182
xmlFreeDoc(msr->crypto_html_tree);
11761183
msr->of_stream_changed = 0;
1184+
msr_log(msr, 4, "inject_hashed_response_body: Stream Output is null.");
11771185
return -1;
11781186
}
11791187

@@ -1188,6 +1196,7 @@ int inject_hashed_response_body(modsec_rec *msr, int elts) {
11881196
if (msr->stream_output_data == NULL) {
11891197
xmlOutputBufferClose(output_buf);
11901198
xmlFreeDoc(msr->crypto_html_tree);
1199+
msr_log(msr, 4, "inject_hashed_response_body: Stream Output Data is null.");
11911200
return -1;
11921201
}
11931202

0 commit comments

Comments
 (0)