summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2021-12-04 21:27:49 +0700
committerDaniil Baturin <daniil@baturin.org>2021-12-04 21:27:49 +0700
commit964ced5a0ffe146115194dc50bf755a241fa40a1 (patch)
treecbfccd4738aa87bf90a2dd3945262a9ecb5f3b45
parent538fe55830e7effe61663c208fa021403360fff8 (diff)
downloadvyos-utils-964ced5a0ffe146115194dc50bf755a241fa40a1.tar.gz
vyos-utils-964ced5a0ffe146115194dc50bf755a241fa40a1.zip
T4047: use full string match in the regex validator
-rw-r--r--src/validate_value.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/validate_value.ml b/src/validate_value.ml
index 32d34de..05d62b1 100644
--- a/src/validate_value.ml
+++ b/src/validate_value.ml
@@ -12,7 +12,7 @@ let rec validate_value buf value_constraint value =
| Group l ->
List.for_all (fun c -> validate_value buf c value) l
| Regex s ->
- (try let _ = Pcre.exec ~pat:s value in true
+ (try let _ = Pcre.exec ~pat:(Printf.sprintf "^%s$" s) value in true
with Not_found -> false)
| Exec c ->
(* XXX: Unix.open_process_in is "shelling out", which is a bad idea on multiple levels,