fixes found from additional tests in 3.1
authorAlan T. DeKok <aland@freeradius.org>
Wed, 30 Dec 2015 16:44:25 +0000 (11:44 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Wed, 30 Dec 2015 16:44:56 +0000 (11:44 -0500)
src/main/evaluate.c

index c00a92a..667d0d9 100644 (file)
@@ -366,10 +366,12 @@ static size_t regex_escape(UNUSED REQUEST *request, char *out, size_t outlen, ch
                        if (outlen < 3) goto done;
 
                        *(p++) = '\\';
+                       outlen--;
                        /* FALL-THROUGH */
 
                default:
                        *(p++) = *(in++);
+                       outlen--;
                        break;
                }
        }
@@ -452,7 +454,8 @@ do {\
 #ifdef HAVE_REGEX
        if (map->op == T_OP_REG_EQ) {
                cast_type = PW_TYPE_STRING;
-               escape = regex_escape;
+
+               if (map->rhs->type == TMPL_TYPE_XLAT_STRUCT) escape = regex_escape;
        }
        else
 #endif