From 59a0a5485a6ee345839e10b11adc072a1fbb14a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 18 Aug 2020 10:35:40 +0200 Subject: [PATCH] Protocols.DNS.async_client: Survive NULL callbacks. Do not complain if the callback function has become NULL when it is time to call it (the initiator may have gone away). Fixes #10051. --- lib/modules/Protocols.pmod/DNS.pmod | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/modules/Protocols.pmod/DNS.pmod b/lib/modules/Protocols.pmod/DNS.pmod index 3865d201a4..b5c3879185 100644 --- a/lib/modules/Protocols.pmod/DNS.pmod +++ b/lib/modules/Protocols.pmod/DNS.pmod @@ -1789,6 +1789,7 @@ class async_client function(string,mapping,mixed...:void) callback, mixed ... args) { + if (!callback) return UNDEFINED; for(int e=next_client ? 100 : 256;e>=0;e--) { int lid = random(65536); @@ -1850,6 +1851,7 @@ class async_client function callback, mixed ... args) { + if (!callback) return UNDEFINED; if(!answer || !answer->an || !sizeof(answer->an)) { if(multi == -1 || multi >= sizeof(domains)) { @@ -2023,6 +2025,7 @@ class async_tcp_client void connectedcb(int ok) { + if (!callback) return; if (!ok) {callback(domain, 0, @args); return;} sock->set_nonblocking(readcb, writecb, closecb); writebuf=sprintf("%2H",req); -- GitLab