summaryrefslogtreecommitdiffstats
path: root/Modules/_struct.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_struct.c')
-rw-r--r--Modules/_struct.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 1c917b7..64a9827 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -1285,6 +1285,10 @@ prepare_s(PyStructObject *self)
size_t ncodes;
fmt = PyBytes_AS_STRING(self->s_format);
+ if (strlen(fmt) != (size_t)PyBytes_GET_SIZE(self->s_format)) {
+ PyErr_SetString(StructError, "embedded null character");
+ return -1;
+ }
f = whichtable(&fmt);