Skip to content

Instantly share code, notes, and snippets.

@johnl
Created July 27, 2012 11:28
Show Gist options
  • Save johnl/3187484 to your computer and use it in GitHub Desktop.
Save johnl/3187484 to your computer and use it in GitHub Desktop.
naxsi 0.46 nginx 1.2.2 compile fix
diff --git a/naxsi/naxsi_src/naxsi_runtime.c b/naxsi/naxsi_src/naxsi_runtime.c
index 1d32f78..7ae0e4f 100644
--- a/naxsi/naxsi_src/naxsi_runtime.c
+++ b/naxsi/naxsi_src/naxsi_runtime.c
@@ -116,7 +116,12 @@ ngx_http_process_basic_rule_buffer(ngx_str_t *str,
tmp_idx = 0;
len = str->len;
while
-#if defined nginx_version && (nginx_version > 1001011)
+#if defined nginx_version && (nginx_version >= 1002002)
+ (tmp_idx < len &&
+ (match = pcre_exec(rl->br->rx->regex->code, 0,
+ (const char *) str->data, str->len, tmp_idx, 0,
+ captures, 6)) >= 0)
+#elif defined nginx_version && (nginx_version > 1001011)
(tmp_idx < len &&
(match = pcre_exec(rl->br->rx->regex->pcre, 0,
(const char *) str->data, str->len, tmp_idx, 0,
@knittledan
Copy link

could you explain how to apply this patch? is there a command line command to run or is there a file that this will replace?

Thanks,

  • Dan

@johnl
Copy link
Author

johnl commented Jul 28, 2012

assuming that the naxsi source is in a directory named naxsi/ you can run this:

curl https://gist.github.com/raw/3187484/3a331c868c413253aae9cba2aff8ad368c96f27b/naxi-0.46-nginx-1.2.2-compile-fix.patch | patch -p1

if it's in the currently directory use -p2 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment