Kaydet (Commit) 69b83b11 authored tarafından Tim Peters's avatar Tim Peters

unicodedata_decomposition(): sprintf -> PyOS_snprintf.

üst 38f3b72f
...@@ -227,7 +227,7 @@ unicodedata_decomposition(PyObject *self, PyObject *args) ...@@ -227,7 +227,7 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
(code&((1<<DECOMP_SHIFT)-1))]; (code&((1<<DECOMP_SHIFT)-1))];
} }
/* high byte is of hex bytes (usually one or two), low byte /* high byte is number of hex bytes (usually one or two), low byte
is prefix code (from*/ is prefix code (from*/
count = decomp_data[index] >> 8; count = decomp_data[index] >> 8;
...@@ -241,7 +241,9 @@ unicodedata_decomposition(PyObject *self, PyObject *args) ...@@ -241,7 +241,9 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
while (count-- > 0) { while (count-- > 0) {
if (i) if (i)
decomp[i++] = ' '; decomp[i++] = ' ';
sprintf(decomp + i, "%04X", decomp_data[++index]); assert((size_t)i < sizeof(decomp));
PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X",
decomp_data[++index]);
i += strlen(decomp + i); i += strlen(decomp + i);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment