diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2018-05-21 12:20:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-21 12:20:55 (GMT) |
commit | e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f (patch) | |
tree | bea2537e61913edd967b076484640a957f4b027e | |
parent | 7208bfb64b74f31f9704be3f01f26861c9cf092b (diff) | |
download | cpython-e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f.zip cpython-e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f.tar.gz cpython-e9e2fd75ccbc6e9a5221cf3525e39e9d042d843f.tar.bz2 |
[3.6] bpo-33542: Ignore DUID in uuid.get_node on Windows. (GH-6922) (GH-7014)
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.
(cherry picked from commit c66c342cb42ab8a88884527ddfe3a5086bc06316)
Co-authored-by: CtrlZvi <viz+github@flippedperspective.com>
-rw-r--r-- | Lib/uuid.py | 2 | ||||
-rw-r--r-- | Misc/ACKS | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst | 2 |
3 files changed, 4 insertions, 1 deletions
diff --git a/Lib/uuid.py b/Lib/uuid.py index 32a48ea..db8b2ef 100644 --- a/Lib/uuid.py +++ b/Lib/uuid.py @@ -438,7 +438,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): return int(value.replace('-', ''), 16) def _netbios_getnode(): @@ -415,6 +415,7 @@ Ulrich Eckhardt David Edelsohn John Edmonds Grant Edwards +Zvi Effron John Ehresman Tal Einat Eric Eisner diff --git a/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst b/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst new file mode 100644 index 0000000..16ba799 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-05-16-09-30-27.bpo-33542.idNAcs.rst @@ -0,0 +1,2 @@ +Prevent ``uuid.get_node`` from using a DUID instead of a MAC on Windows. +Patch by Zvi Effron |