]> granicus.if.org Git - apache/commitdiff
r:regex was not returning the last captured group, as we were one off on how many...
authorDaniel Gruno <humbedooh@apache.org>
Wed, 13 Feb 2013 14:02:43 +0000 (14:02 +0000)
committerDaniel Gruno <humbedooh@apache.org>
Wed, 13 Feb 2013 14:02:43 +0000 (14:02 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1445609 13f79535-47bb-0310-9956-ffa450edef68

modules/lua/lua_request.c

index c1267f3cbd50e407b0a04a32bb29e5626cee457c..e1a417d5d8552b91c2dca890bbb2546b63e2fd24 100644 (file)
@@ -901,7 +901,7 @@ static int lua_ap_regex(lua_State *L)
     *source;
     char           *err;
     ap_regex_t regex;
-    ap_regmatch_t matches[AP_MAX_REG_MATCH];
+    ap_regmatch_t matches[AP_MAX_REG_MATCH+1];
 
     luaL_checktype(L, 1, LUA_TUSERDATA);
     luaL_checktype(L, 2, LUA_TSTRING);
@@ -926,7 +926,7 @@ static int lua_ap_regex(lua_State *L)
     }
     
     lua_newtable(L);
-    for (i = 0; i < regex.re_nsub; i++) {
+    for (i = 0; i <= regex.re_nsub; i++) {
         lua_pushinteger(L, i);
         if (matches[i].rm_so >= 0 && matches[i].rm_eo >= 0)
             lua_pushstring(L,