From b363fb48a51fd902335c0c99cd9a992cf1f8c4cf Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 13 Jun 2024 03:55:01 -0400 Subject: [PATCH] Fix string equality check The `$proto` interpolation wasn't quoted with `\Q` and `\E`, so metacharacters in `$proto` could break the matching. Switch from a regex to an expression to fix the equality check and improve readability. --- ddclient.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddclient.in b/ddclient.in index 0f4cf74..c0bec0f 100755 --- a/ddclient.in +++ b/ddclient.in @@ -2019,8 +2019,8 @@ sub init_config { HOST: for my $h (keys %config) { my $proto = opt('protocol', $h); - load_sha1_support($proto) if (grep(/^$proto$/, ("freedns", "nfsn"))); - load_json_support($proto) if (grep(/^$proto$/, ("1984", "cloudflare", "digitalocean", "gandi", "godaddy", "hetzner", "yandex", "nfsn", "njalla", "porkbun", "dnsexit2"))); + load_sha1_support($proto) if (grep($_ eq $proto, ("freedns", "nfsn"))); + load_json_support($proto) if (grep($_ eq $proto, ("1984", "cloudflare", "digitalocean", "gandi", "godaddy", "hetzner", "yandex", "nfsn", "njalla", "porkbun", "dnsexit2"))); if (!exists($protocols{$proto})) { warning("skipping host: %s: unrecognized protocol '%s'", $h, $proto);