From 5dd3c9622ab6a8e75870bc5351499155e7963abc Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Fri, 12 Sep 2003 15:32:16 +0000 Subject: [PATCH] fix a problem with strcpy() in xmlXPathFormatNumber() valgrind pointed out * xpath.c: fix a problem with strcpy() in xmlXPathFormatNumber() valgrind pointed out the strings overlapped. cleanup . Daniel --- ChangeLog | 5 +++++ xpath.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77e33b46..2e10f473 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 12 17:24:11 CEST 2003 Daniel Veillard + + * xpath.c: fix a problem with strcpy() in xmlXPathFormatNumber() + valgrind pointed out the strings overlapped. cleanup . + Fri Sep 12 11:43:12 CEST 2003 Daniel Veillard * tree.c: applied speedup to xmlSearchNs() as suggested by diff --git a/xpath.c b/xpath.c index 2e0c9ebf..7946fd67 100644 --- a/xpath.c +++ b/xpath.c @@ -1231,7 +1231,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) ; if (*ptr != '.') ptr++; - strcpy(ptr, after_fraction); + while ((*ptr++ = *after_fraction++) != 0); /* Finally copy result back to caller */ size = strlen(work) + 1; @@ -1239,7 +1239,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) work[buffersize - 1] = 0; size = buffersize; } - memcpy(buffer, work, size); + memmove(buffer, work, size); } break; }