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:28:23 +0700 |
commit | f19a5e813d7a311601dbbc3014522d606d1bba39 (patch) | |
tree | ec1f7d22157402aa38109fbb56ab76b710ce8deb | |
parent | bc86635c2b92d3ba173dc17d7da45017ab8aa21f (diff) | |
download | vyos-utils-f19a5e813d7a311601dbbc3014522d606d1bba39.tar.gz vyos-utils-f19a5e813d7a311601dbbc3014522d606d1bba39.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 0b4148f..24c2556 100644 --- a/src/validate_value.ml +++ b/src/validate_value.ml @@ -3,7 +3,7 @@ type check = Regex of string | Exec of string let validate_value buf value_constraint value = match value_constraint with | 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, |