Kaydet (Commit) da8d216e authored tarafından Fred Drake's avatar Fred Drake

Protect against core dumps in gdbm: don't allow access by key once the

database is closed.  Raise gdbm.error instead.

Bug report #198 submitted by Barry Haddow <bhaddow@orbism.com>.
üst a710d6e2
......@@ -156,6 +156,11 @@ register PyObject *key;
if (!PyArg_Parse(key, "s#", &krec.dptr, &krec.dsize) )
return NULL;
if (dp->di_dbm == NULL) {
PyErr_SetString(DbmError,
"GDBM object has already been closed");
return NULL;
}
drec = gdbm_fetch(dp->di_dbm, krec);
if ( drec.dptr == 0 ) {
PyErr_SetString(PyExc_KeyError,
......@@ -180,7 +185,8 @@ PyObject *v, *w;
return -1;
}
if (dp->di_dbm == NULL) {
PyErr_SetString(DbmError, "GDBM object has already been closed");
PyErr_SetString(DbmError,
"GDBM object has already been closed");
return -1;
}
dp->di_size = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment