1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

replaced sprintf() with snprintf() to prevent possible buffer overflow

* DOCBparser.c HTMLparser.c debugXML.c encoding.c
nanoftp.c nanohttp.c parser.c tree.c uri.c xmlIO.c
xmllint.c xpath.c: replaced sprintf() with snprintf()
to prevent possible buffer overflow (the bug was pointed
out by Anju Premachandran)
This commit is contained in:
Aleksey Sanin
2002-06-14 17:07:10 +00:00
parent e059b891ef
commit 49cc97565f
13 changed files with 72 additions and 45 deletions

View File

@ -1980,11 +1980,11 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input,
#endif /* LIBXML_XPATH_ENABLED */
while (1) {
if (ctxt->node == (xmlNodePtr) ctxt->doc)
sprintf(prompt, "%s > ", "/");
snprintf(prompt, sizeof(prompt), "%s > ", "/");
else if (ctxt->node->name)
snprintf(prompt, sizeof(prompt), "%s > ", ctxt->node->name);
else
sprintf(prompt, "? > ");
snprintf(prompt, sizeof(prompt), "? > ");
prompt[sizeof(prompt) - 1] = 0;
/*