diff options
author | unknown <serg@serg.mylan> | 2004-04-28 15:46:08 +0200 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2004-04-28 15:46:08 +0200 |
commit | 3ac0c7d85d43442dbf392d6a0743ee5ae55e317b (patch) | |
tree | 1113f75c2b6e2fd5e271480250713e4e0b67d735 /extra/replace.c | |
parent | ad3d7a210df918b1f01e55f08fb15e7f95eb11c6 (diff) | |
download | mariadb-git-3ac0c7d85d43442dbf392d6a0743ee5ae55e317b.tar.gz |
memory overflow in replace.c fixed
Diffstat (limited to 'extra/replace.c')
-rw-r--r-- | extra/replace.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/extra/replace.c b/extra/replace.c index 422cfdbac36..b31b64aaff7 100644 --- a/extra/replace.c +++ b/extra/replace.c @@ -279,6 +279,8 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name) length=(uint) strlen(name)+1; if (pa->length+length >= pa->max_length) { + pa->max_length=(pa->length+length+MALLOC_OVERHEAD+PS_MALLOC-1)/PS_MALLOC; + pa->max_length=pa->max_length*PS_MALLOC-MALLOC_OVERHEAD; if (!(new_pos= (byte*) my_realloc((gptr) pa->str, (uint) (pa->max_length+PS_MALLOC), MYF(MY_WME)))) @@ -291,7 +293,6 @@ int insert_pointer_name(reg1 POINTER_ARRAY *pa,my_string name) char*); pa->str=new_pos; } - pa->max_length+=PS_MALLOC; } if (pa->typelib.count >= pa->max_count-1) { |