Skip to content

Commit 0d5a8de

Browse files
author
Marc Stern
committed
Compatibility with libyajl decoding the buffer inline
1 parent b3b33c9 commit 0d5a8de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apache2/msc_json.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,9 @@ int json_init(modsec_rec *msr, char **error_msg) {
354354
int json_process_chunk(modsec_rec *msr, const char *buf, unsigned int size, char **error_msg) {
355355
if (error_msg == NULL) return -1;
356356
*error_msg = NULL;
357-
base_offset=buf;
357+
// Take a copy in case libyajl decodes the buffer inline
358+
base_offset = apr_pstrmemdup(msr->mp, buf, size);
359+
if (!base_offset) return -1;
358360

359361
/* Feed our parser and catch any errors */
360362
msr->json->status = yajl_parse(msr->json->handle, buf, size);

0 commit comments

Comments
 (0)