From 24a22092ca7cd3e532042a159e57c5b84688aac2 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 30 May 2024 18:02:01 -0400 Subject: [PATCH] dnsexit2: Don't croak if JSON decoding fails --- ddclient.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ddclient.in b/ddclient.in index 7b4350a..6811588 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4216,7 +4216,11 @@ sub nic_dnsexit2_update { next; } my $body = ($reply =~ s/^.*?\r?\n\r?\n//sr); - my $response = decode_json($body); + my $response = eval { decode_json($body); }; + if (!$response) { + failed("failed to parse response: $@"); + next; + } if (!defined($response->{'code'}) || !defined($response->{'message'})) { failed("Did not receive expected \"code\" and \"message\" keys in server response."); failed("Response:");