[Python-checkins] cpython: Issue #9647: os.confstr() ensures that the second call to confstr() returns the

victor.stinner python-checkins at python.org
Fri Dec 5 22:52:32 CET 2014


https://hg.python.org/cpython/rev/a7a8947e9ce4
changeset:   93743:a7a8947e9ce4
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Dec 05 22:51:51 2014 +0100
summary:
  Issue #9647: os.confstr() ensures that the second call to confstr() returns the
same length.

files:
  Modules/posixmodule.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -14369,10 +14369,12 @@
     }
 
     if (len >= sizeof(buffer)) {
+        size_t len2;
         char *buf = PyMem_Malloc(len);
         if (buf == NULL)
             return PyErr_NoMemory();
-        confstr(name, buf, len);
+        len2 = confstr(name, buf, len);
+        assert(len == len2);
         result = PyUnicode_DecodeFSDefaultAndSize(buf, len-1);
         PyMem_Free(buf);
     }

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list