summaryrefslogtreecommitdiffstats
path: root/Python/dynload_shlib.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-20 20:17:55 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-20 20:17:55 (GMT)
commit27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f (patch)
tree5e8e1bc287f543abf522f732bc1601bf97629150 /Python/dynload_shlib.c
parent58ceecfe5ac0ad436d556b589870dd2df62731c0 (diff)
downloadcpython-27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f.zip
cpython-27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f.tar.gz
cpython-27c4c3ec799dfe95bd80706a6bc9a39f2af6da6f.tar.bz2
Check return value of fstat() in _PyImport_GetDynLoadFunc()
CID 486250
Diffstat (limited to 'Python/dynload_shlib.c')
-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 0ca65c7..e220b21 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) {