diff Python/dynload_shlib.c @ 84741:654268ff29b5 3.3

Check return value of fstat() in _PyImport_GetDynLoadFunc() CID 486250
author Christian Heimes <christian@cheimes.de>
date Sat, 20 Jul 2013 22:17:55 +0200
parents eaac55703796
children 042ff9325c5e 222404bce3da
line wrap: on
line diff
--- a/Python/dynload_shlib.c	Sat Jul 20 17:59:13 2013 +0100
+++ b/Python/dynload_shlib.c	Sat Jul 20 22:17:55 2013 +0200
@@ -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) {