summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-30 07:23:05 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-30 07:23:05 (GMT)
commit69b83b113f9e6fed321288ea23bca2aa673a7beb (patch)
tree40c38f38e0f779e8d17c5f09538462a10a228552 /Modules
parent38f3b72f9ff394f99c1eafa269da8f3a6099da1e (diff)
downloadcpython-69b83b113f9e6fed321288ea23bca2aa673a7beb.zip
cpython-69b83b113f9e6fed321288ea23bca2aa673a7beb.tar.gz
cpython-69b83b113f9e6fed321288ea23bca2aa673a7beb.tar.bz2
unicodedata_decomposition(): sprintf -> PyOS_snprintf.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/unicodedata.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/unicodedata.c b/Modules/unicodedata.c
index 4711123..36c96e4 100644
--- a/Modules/unicodedata.c
+++ b/Modules/unicodedata.c
@@ -227,7 +227,7 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
(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*/
count = decomp_data[index] >> 8;
@@ -241,7 +241,9 @@ unicodedata_decomposition(PyObject *self, PyObject *args)
while (count-- > 0) {
if (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);
}