]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Remove redundant check in dbm.open() (GH-111844)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 8 Nov 2023 17:42:41 +0000 (19:42 +0200)
committerGitHub <noreply@github.com>
Wed, 8 Nov 2023 17:42:41 +0000 (19:42 +0200)
PyUnicode_FSConverter() already checks for embedded null characters.

Modules/_dbmmodule.c

index d50d2f1ef185970266564cd4dcc3262976f18c7c..ee33fe625be3d707e3ca9216cfa0eb5fd3aa45d2 100644 (file)
@@ -557,11 +557,6 @@ dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
     }
 
     const char *name = PyBytes_AS_STRING(filenamebytes);
-    if (strlen(name) != (size_t)PyBytes_GET_SIZE(filenamebytes)) {
-        Py_DECREF(filenamebytes);
-        PyErr_SetString(PyExc_ValueError, "embedded null character");
-        return NULL;
-    }
     PyObject *self = newdbmobject(state, name, iflags, mode);
     Py_DECREF(filenamebytes);
     return self;