Commit e96c75fe authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Fixed bug in memory allocation that could affect 64 bit systems (affected hammer)

parent 3cdc8ae5
......@@ -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()
{
......
......@@ -953,7 +953,7 @@ int ha_myisam::create(const char *name, register TABLE *form,
&keydef, form->keys*sizeof(MI_KEYDEF),
&keyseg,
((form->key_parts + form->keys) * sizeof(MI_KEYSEG)),
0)))
NullS)))
DBUG_RETURN(1);
pos=form->key_info;
......
......@@ -1067,6 +1067,7 @@ void sql_print_error(const char *format,...)
char buff[1024];
my_vsnprintf(buff,sizeof(buff)-1,format,args);
DBUG_PRINT("error",("%s",buff));
va_end(args);
va_start(args,format);
}
#endif
......
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