aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-01-28 11:26:04 +0200
committerRiccardo Spagni <ric@spagni.net>2016-01-28 11:26:04 +0200
commitae8afe42569e2379659ccd107596d9a1bc38b4e2 (patch)
tree84d0604cf77bd80338f96d012c49b765cbdf6647
parentMerge pull request #623 (diff)
parentMDB_VL32 Fix off-by-one in mdb_midl_shrink (diff)
downloadmonero-ae8afe42569e2379659ccd107596d9a1bc38b4e2.tar.xz
Merge pull request #625
7e65cc0 MDB_VL32 Fix off-by-one in mdb_midl_shrink (Howard Chu) 222e30e MDB_VL32 Fix another 32bit overflow (Howard Chu) 3ca6e85 Tweak mdb_strerror msg buffer (Howard Chu) 78ad970 MDB_VL32 Fix d2a5f72f73e0e4030b521086b13b8c8efaf9ca9e (Howard Chu) 2aa0b3b updated gtest (added missing files) (Riccardo Spagni) 83d586c updated gtest (Riccardo Spagni) fdc10ff even more typos (Henning Kopp) da5415a more typos fixed (Henning Kopp) a8c6f15 fixed typo (Henning Kopp) 423c7fe simplewallet: remove leftover command line refresh-type handling (moneromooo-monero)
-rw-r--r--external/db_drivers/liblmdb/mdb.c11
-rw-r--r--external/db_drivers/liblmdb/midl.c2
2 files changed, 7 insertions, 6 deletions
diff --git a/external/db_drivers/liblmdb/mdb.c b/external/db_drivers/liblmdb/mdb.c
index 4c9e22388..d524d3523 100644
--- a/external/db_drivers/liblmdb/mdb.c
+++ b/external/db_drivers/liblmdb/mdb.c
@@ -1572,8 +1572,9 @@ mdb_strerror(int err)
* This works as long as no function between the call to mdb_strerror
* and the actual use of the message uses more than 4K of stack.
*/
- char pad[4096];
- char buf[1024], *ptr = buf;
+#define MSGSIZE 1024
+#define PADSIZE 4096
+ char buf[MSGSIZE+PADSIZE], *ptr = buf;
#endif
int i;
if (!err)
@@ -1605,7 +1606,7 @@ mdb_strerror(int err)
buf[0] = 0;
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, err, 0, ptr, sizeof(buf), (va_list *)pad);
+ NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE);
return ptr;
#else
return strerror(err);
@@ -2428,7 +2429,7 @@ mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp)
rc = MDB_MAP_FULL;
goto fail;
}
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(MDB_VL32)
if (!(env->me_flags & MDB_RDONLY)) {
void *p;
p = (MDB_page *)(env->me_map + env->me_psize * pgno);
@@ -4272,7 +4273,7 @@ mdb_env_set_mapsize(MDB_env *env, mdb_size_t size)
size = meta->mm_mapsize;
{
/* Silently round up to minimum if the size is too small */
- size_t minsize = (meta->mm_last_pg + 1) * env->me_psize;
+ mdb_size_t minsize = (meta->mm_last_pg + 1) * env->me_psize;
if (size < minsize)
size = minsize;
}
diff --git a/external/db_drivers/liblmdb/midl.c b/external/db_drivers/liblmdb/midl.c
index e2005d16c..152a1ec0d 100644
--- a/external/db_drivers/liblmdb/midl.c
+++ b/external/db_drivers/liblmdb/midl.c
@@ -120,7 +120,7 @@ void mdb_midl_shrink( MDB_IDL *idp )
{
MDB_IDL ids = *idp;
if (*(--ids) > MDB_IDL_UM_MAX &&
- (ids = realloc(ids, (MDB_IDL_UM_MAX+1) * sizeof(MDB_ID))))
+ (ids = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID))))
{
*ids++ = MDB_IDL_UM_MAX;
*idp = ids;