mirror of
https://github.com/python/cpython.git
synced 2025-08-31 22:18:28 +00:00
gh-122431: Disallow negative values in readline.append_history_file
(#122469)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
67b9a5331a
commit
208b0fb645
3 changed files with 15 additions and 0 deletions
|
@ -351,6 +351,12 @@ readline_append_history_file_impl(PyObject *module, int nelements,
|
|||
PyObject *filename_obj)
|
||||
/*[clinic end generated code: output=5df06fc9da56e4e4 input=784b774db3a4b7c5]*/
|
||||
{
|
||||
if (nelements < 0)
|
||||
{
|
||||
PyErr_SetString(PyExc_ValueError, "nelements must be positive");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *filename_bytes;
|
||||
const char *filename;
|
||||
int err;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue