1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) 9edc162583: [Backport #17781]

[ruby/resolv] Fix confusion of received response message

	This is a follow up for commit 33fb966197f1 ("Remove sender/message_id
	pair after response received in resolv", 2020-09-11).

	As the @senders instance variable is also used for tracking transaction
	ID allocation, simply removing an entry without releasing the ID would
	eventually deplete the ID space and cause
	Resolv::DNS.allocate_request_id to hang.

	It seems the intention of the code was to check that the received DNS
	message is actually the response for the question made within the method
	earlier. Let's have it actually do so.

	[Bug #12838] https://bugs.ruby-lang.org/issues/12838
	[Bug #17748] https://bugs.ruby-lang.org/issues/17748

	53ca9c9209
	---
	 lib/resolv.rb | 6 +++---
	 1 file changed, 3 insertions(+), 3 deletions(-)
This commit is contained in:
nagachika 2021-05-22 15:20:23 +09:00
parent e175917f66
commit 9c0df2e81c
2 changed files with 4 additions and 4 deletions

View file

@ -696,17 +696,17 @@ class Resolv
rescue DecodeError
next # broken DNS message ignored
end
if s = sender_for(from, msg)
if sender == sender_for(from, msg)
break
else
# unexpected DNS message ignored
end
end
return msg, s.data
return msg, sender.data
end
def sender_for(addr, msg)
@senders.delete([addr,msg.id])
@senders[[addr,msg.id]]
end
def close

View file

@ -12,7 +12,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 2
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 77
#define RUBY_PATCHLEVEL 78
#define RUBY_RELEASE_YEAR 2021
#define RUBY_RELEASE_MONTH 5