]> granicus.if.org Git - python/commitdiff
Check return value of fstat() in _PyImport_GetDynLoadFunc()
authorChristian Heimes <christian@cheimes.de>
Sat, 20 Jul 2013 20:17:55 +0000 (22:17 +0200)
committerChristian Heimes <christian@cheimes.de>
Sat, 20 Jul 2013 20:17:55 +0000 (22:17 +0200)
CID 486250

Python/dynload_shlib.c

index 0ca65c78774c1dcef6274049fd22371c089628ad..e220b2152239e80fd93b9439abeeabb00f35c9ba 100644 (file)
@@ -90,7 +90,9 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
     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) {