https://github.com/python/cpython/commit/ff918c652c2c53ce037d7a27b19776fb6e4d69c4 commit: ff918c652c2c53ce037d7a27b19776fb6e4d69c4 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: sobolevn <[email protected]> date: 2026-11-14T06:19:38Z summary:
[3.15] gh-101703: Use `PyOS_snprintf` in `_freeze_module` (GH-161871) (#161980) gh-101703: Use `PyOS_snprintf` in `_freeze_module` (GH-161871) (cherry picked from commit 713c16ec40960b800a473b5be5483c7b007bea24) Co-authored-by: sobolevn <[email protected]> files: M Programs/_freeze_module.c diff --git a/Programs/_freeze_module.c b/Programs/_freeze_module.c index 27a60171f3eca86..ae134f6caef1d59 100644 --- a/Programs/_freeze_module.c +++ b/Programs/_freeze_module.c @@ -122,11 +122,12 @@ read_text(const char *inpath) static PyObject * compile_and_marshal(const char *name, const char *text) { - char *filename = (char *) malloc(strlen(name) + 10); + int text_size = strlen(name) + 10; + char *filename = (char *) malloc(text_size); if (filename == NULL) { return PyErr_NoMemory(); } - sprintf(filename, "<frozen %s>", name); + PyOS_snprintf(filename, text_size, "<frozen %s>", name); PyObject *code = Py_CompileStringExFlags(text, filename, Py_file_input, NULL, 0); free(filename); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
