summaryrefslogtreecommitdiffstats
path: root/Modules/cPickle.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/cPickle.c')
-rw-r--r--Modules/cPickle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index 486e86f..a849424 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -663,6 +663,12 @@ read_other(Unpicklerobject *self, char **s, Py_ssize_t n)
self->last_string = str;
if (! (*s = PyString_AsString(str))) return -1;
+
+ if (PyString_GET_SIZE(str) != n) {
+ PyErr_SetNone(PyExc_EOFError);
+ return -1;
+ }
+
return n;
}