diff options
author | unknown <sasha@mysql.sashanet.com> | 2002-03-02 12:45:44 -0700 |
---|---|---|
committer | unknown <sasha@mysql.sashanet.com> | 2002-03-02 12:45:44 -0700 |
commit | 7e1edb01dbb4756c88f9c93f188f03eb8d11142c (patch) | |
tree | 99e834e2590a4246f2141adfa908a6f92809b04b /mysys/my_vsnprintf.c | |
parent | 3eb9c0be7df702a8af47daa2d01929704d8a41c9 (diff) | |
download | mariadb-git-7e1edb01dbb4756c88f9c93f188f03eb8d11142c.tar.gz |
load local fix
overrun sentry in my_vsnprintf() test
will not be pushed yet
BUILD/FINISH.sh:
load local fix
BUILD/SETUP.sh:
load local fix
BUILD/compile-pentium-debug-max:
load local fix
configure.in:
load local fix
mysys/my_vsnprintf.c:
added overrun sentry to the test
Diffstat (limited to 'mysys/my_vsnprintf.c')
-rw-r--r-- | mysys/my_vsnprintf.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mysys/my_vsnprintf.c b/mysys/my_vsnprintf.c index 7b6d9672eb6..7490ab4a9f2 100644 --- a/mysys/my_vsnprintf.c +++ b/mysys/my_vsnprintf.c @@ -80,15 +80,22 @@ int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap) } #ifdef MAIN +#define OVERRUN_SENTRY 250 static void my_printf(const char * fmt, ...) { - char buf[32]; + char buf[33]; int n; va_list ar; va_start(ar, fmt); - n = my_vsnprintf(buf, sizeof(buf),fmt, ar); + buf[sizeof(buf)-1]=OVERRUN_SENTRY; + n = my_vsnprintf(buf, sizeof(buf)-1,fmt, ar); printf(buf); printf("n=%d, strlen=%d\n", n, strlen(buf)); + if (buf[sizeof(buf)-1] != OVERRUN_SENTRY) + { + fprintf(stderr, "Buffer overrun\n"); + abort(); + } va_end(ar); } |