summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 20:18:19 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 20:18:19 (GMT)
commit7bc80fcf4e32ed82b7932f3658474408a5c7a0a2 (patch)
tree4e1f1be388afd1256e8950eea880956a8e3f1eb7 /Python
parent2894073e1ac339d3d8b72e6d3f7543da0cb237f1 (diff)
parent27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f (diff)
downloadcpython-7bc80fcf4e32ed82b7932f3658474408a5c7a0a2.zip
cpython-7bc80fcf4e32ed82b7932f3658474408a5c7a0a2.tar.gz
cpython-7bc80fcf4e32ed82b7932f3658474408a5c7a0a2.tar.bz2
Check return value of fstat() in _PyImport_GetDynLoadFunc()
CID 486250
Diffstat (limited to 'Python')
-rw-r--r--Python/dynload_shlib.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
index 46fed6e..50e6982 100644
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -81,7 +81,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) {