File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -143,15 +143,24 @@ class IN answer.
143
143
# pylint: disable=too-many-nested-blocks
144
144
try :
145
145
for answer in range (answer_count ):
146
+ # Move the pointer past the name.
146
147
label_length = response [pointer ]
147
- if label_length >= 0xC0 :
148
- # Pointer to the domain name, skip over it.
149
- pointer += 2
150
- else :
151
- # Domain name, skip through it.
152
- while label_length != 0x00 : # Null represents root of domain name
148
+ while True :
149
+ if label_length >= 0xC0 :
150
+ # Pointer to a section of domain name, skip over it.
151
+ pointer += 2
152
+ label_length = response [pointer ]
153
+ if label_length == 0 :
154
+ # One byte past the end of the name.
155
+ break
156
+ else :
157
+ # Section of the domain name, skip through it.
153
158
pointer += label_length
154
159
label_length = response [pointer ]
160
+ if label_length == 0 :
161
+ # On the null byte at the end of the name. Increment the pointer.
162
+ pointer += 1
163
+ break
155
164
# Check for a type A answer.
156
165
if int .from_bytes (response [pointer : pointer + 2 ], "big" ) == TYPE_A :
157
166
# Check for an IN class answer.
You can’t perform that action at this time.
0 commit comments