[Python-checkins] cpython (3.3): Check return value of fstat() in _PyImport_GetDynLoadFunc()

christian.heimes python-checkins at python.org
Sat Jul 20 22:19:00 CEST 2013


http://hg.python.org/cpython/rev/654268ff29b5
changeset:   84741:654268ff29b5
branch:      3.3
parent:      84736:ce771c2d0220
user:        Christian Heimes <christian at cheimes.de>
date:        Sat Jul 20 22:17:55 2013 +0200
summary:
  Check return value of fstat() in  _PyImport_GetDynLoadFunc()
CID 486250

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


diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -90,7 +90,9 @@
     if (fp != NULL) {
         int i;
         struct stat statb;
-        fstat(fileno(fp), &statb);
+        if (fstat(fileno(fp), &statb) == -1) {
+            return PyErr_SetFromErrno(PyExc_IOError);
+        }
         for (i = 0; i < nhandles; i++) {
             if (statb.st_dev == handles[i].dev &&
                 statb.st_ino == handles[i].ino) {

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


More information about the Python-checkins mailing list