1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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

This commit is contained in:
monty@narttu.mysql.fi
2003-04-03 13:07:42 +03:00
parent 3cdc8ae55b
commit e96c75fec0
3 changed files with 10 additions and 2 deletions

View File

@@ -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()
{

View File

@@ -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;

View File

@@ -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