From 1c94ed6063c6fc24a3f1cf175ed6abfcda7e5689 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 24 Jul 2024 18:49:43 -0400 Subject: [PATCH] dnsexit2: Check for JSON object, not just truthiness --- ddclient.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ddclient.in b/ddclient.in index a6b3f7f..a5de3c1 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4028,8 +4028,8 @@ sub dnsexit2_update_host { } (my $body = $reply) =~ s/^.*?\r?\n\r?\n//s; my $response = eval { decode_json($body); }; - if (!$response) { - failed("$h: failed to parse response: $@"); + if (ref($response) ne 'HASH') { + failed("$h: response is not a JSON object:\n$body"); return; } if (!defined($response->{'code'}) || !defined($response->{'message'})) {