diff options
author | Daniil Baturin <daniil@baturin.org> | 2021-12-04 21:27:49 +0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2021-12-04 21:27:49 +0700 |
commit | 964ced5a0ffe146115194dc50bf755a241fa40a1 (patch) | |
tree | cbfccd4738aa87bf90a2dd3945262a9ecb5f3b45 | |
parent | 538fe55830e7effe61663c208fa021403360fff8 (diff) | |
download | vyos-utils-964ced5a0ffe146115194dc50bf755a241fa40a1.tar.gz vyos-utils-964ced5a0ffe146115194dc50bf755a241fa40a1.zip |
T4047: use full string match in the regex validator
-rw-r--r-- | src/validate_value.ml | 2 |
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, |