From c66c342cb42ab8a88884527ddfe3a5086bc06316 Mon Sep 17 00:00:00 2001 From: CtrlZvi Date: Sun, 20 May 2018 08:03:25 -0700 Subject: bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) uuid._ipconfig_getnode did not validate the maximum length of the value, so long as the value had the same type of formatting as a MAC address. This let it select DUIDs as MAC addresses. It now requires an exact length match. --- Lib/uuid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/uuid.py') diff --git a/Lib/uuid.py b/Lib/uuid.py index 9cb73e8771..66383218e7 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -488,7 +488,7 @@ def _ipconfig_getnode(): with proc: for line in proc.stdout: value = line.split(':')[-1].strip().lower() - if re.match('([0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value): + if re.fullmatch('(?:[0-9a-f][0-9a-f]-){5}[0-9a-f][0-9a-f]', value): mac = int(value.replace('-', ''), 16) if _is_universal(mac): return mac -- cgit v1.2.1