Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use PyOS_snprintf instead of snprintf
  • Loading branch information
jschueller committed Jan 13, 2020
commit 768add562d5a2b36c5bb7a0a788dffe0a6c9ebc8
4 changes: 2 additions & 2 deletions Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ dectuple_as_str(PyObject *dectuple)
goto error;
}

n = snprintf(cp, mem, "%s", sign_special);
n = PyOS_snprintf(cp, mem, "%s", sign_special);
if (n < 0 || n >= mem) {
PyErr_SetString(PyExc_RuntimeError,
"internal error in dec_sequence_as_str");
Expand Down Expand Up @@ -2400,7 +2400,7 @@ dectuple_as_str(PyObject *dectuple)
if (sign_special[1] == '\0') {
/* not a special number */
*cp++ = 'E';
n = snprintf(cp, MPD_EXPDIGITS+2, "%" PRI_mpd_ssize_t, exp);
n = PyOS_snprintf(cp, MPD_EXPDIGITS+2, "%" PRI_mpd_ssize_t, exp);
if (n < 0 || n >= MPD_EXPDIGITS+2) {
PyErr_SetString(PyExc_RuntimeError,
"internal error in dec_sequence_as_str");
Expand Down
1 change: 0 additions & 1 deletion Modules/socketmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ remove_unusable_flags(PyObject *m)
#ifdef MS_WIN32
#undef EAFNOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define snprintf _snprintf
#endif

#ifndef SOCKETCLOSE
Expand Down
2 changes: 1 addition & 1 deletion Objects/obmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2377,7 +2377,7 @@ _PyMem_DebugCheckAddress(char api, const void *p)
id = (char)q[-SST];
if (id != api) {
msg = msgbuf;
snprintf(msgbuf, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
PyOS_snprintf(msgbuf, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api);
msgbuf[sizeof(msgbuf)-1] = 0;
goto error;
}
Expand Down