8000 prevent parsing of malformed fulltopics (#226) · useful-esp8266-lib/tdm@b2b661a · GitHub
[go: up one dir, main page]

Skip to content

Commit b2b661a

Browse files
authored
prevent parsing of malformed fulltopics (jziolkowski#226)
1 parent 1a47898 commit b2b661a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tdmgr.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,9 @@ def mqtt_message(self, topic, msg):
370370
)
371371
if match:
372372
# assume that the matched topic is the one configured in device settings
373-
possible_topic = match.groupdict().get("topic")
374-
if possible_topic not in ("tele", "stat"):
373+
if (
374+
possible_topic := match.groupdict().get("topic")
375+
) and possible_topic not in ("tele", "stat"):
375376
# if the assumed topic is different from tele or stat, there is a chance
376377
# that it's a valid topic. query the assumed device for its FullTopic.
377378
# False positives won't reply.

0 commit comments

Comments
 (0)
0