summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-04-03 13:07:42 +0300
committerunknown <monty@narttu.mysql.fi>2003-04-03 13:07:42 +0300
commitcd30004b0da611f7a29f3e003d26cfd08473f268 (patch)
treeca9fb70f9dfcab0d4ec8417433c20b4c46587b71 /mysys
parentc301d04b26ffd8b1fa96038071490a7fbd3a4a1b (diff)
downloadmariadb-git-cd30004b0da611f7a29f3e003d26cfd08473f268.tar.gz
Fixed bug in memory allocation that could affect 64 bit systems (affected hammer)
mysys/my_vsnprintf.c: safety fix sql/log.cc: safety fix
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_vsnprintf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c
index ab8edec4d7b..9bc33e28ba1 100644
--- a/mysys/my_vsnprintf.c
+++ b/mysys/my_vsnprintf.c
@@ -21,13 +21,18 @@
#include <stdarg.h>
#include <m_ctype.h>
+
int my_snprintf(char* to, size_t n, const char* fmt, ...)
{
+ int result;
va_list args;
va_start(args,fmt);
- return my_vsnprintf(to, n, fmt, args);
+ result= my_vsnprintf(to, n, fmt, args);
+ va_end(args);
+ return result;
}
+
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
{
char *start=to, *end=to+n-1;
@@ -79,6 +84,7 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
return (uint) (to - start);
}
+
#ifdef MAIN
static void my_printf(const char * fmt, ...)
{
@@ -92,6 +98,7 @@ static void my_printf(const char * fmt, ...)
va_end(ar);
}
+
int main()
{