summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-01-23 23:30:19 (GMT)
committerGitHub <noreply@github.com>2023-01-23 23:30:19 (GMT)
commit5964b1282919b4f82fbe7f4afd28624a4564dc04 (patch)
tree4699275ba2d07b70b4457429fde508c9b44b5bc4 /Misc
parent4cf41693508f2c670189c0231233e6b4d5109714 (diff)
downloadcpython-5964b1282919b4f82fbe7f4afd28624a4564dc04.zip
cpython-5964b1282919b4f82fbe7f4afd28624a4564dc04.tar.gz
cpython-5964b1282919b4f82fbe7f4afd28624a4564dc04.tar.bz2
gh-100795: Don't call freeaddrinfo on failure. (GH-101252)
When getaddrinfo returns an error, the output pointer is in an unknown state Don't call freeaddrinfo on it. See the issue for discussion and details with links to reasoning. _Most_ libc getaddrinfo implementations never modify the output pointer unless they are returning success. (cherry picked from commit b724ac2fe7fbb5a7a33d639cad8e748f17b325e0) Co-authored-by: Gregory P. Smith <greg@krypto.org> Co-authored-by: Sergey G. Brester <github@sebres.de> Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst3
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst b/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
new file mode 100644
index 0000000..4cb56ea
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-01-21-16-50-22.gh-issue-100795.NPMZf7.rst
@@ -0,0 +1,3 @@
+Avoid potential unexpected ``freeaddrinfo`` call (double free) in :mod:`socket`
+when when a libc ``getaddrinfo()`` implementation leaves garbage in an output
+pointer when returning an error. Original patch by Sergey G. Brester.