From: Christian Heimes Date: Sat, 20 Jul 2013 20:17:55 +0000 (+0200) Subject: Check return value of fstat() in _PyImport_GetDynLoadFunc() X-Git-Tag: v3.4.0a1~128^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f;p=python Check return value of fstat() in _PyImport_GetDynLoadFunc() CID 486250 --- diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c index 0ca65c7877..e220b21522 100644 --- a/Python/dynload_shlib.c +++ b/Python/dynload_shlib.c @@ -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) {