From: Howard Chu Date: Mon, 15 Feb 2016 00:07:04 +0000 (+0000) Subject: Tweak Win32 errmsg buffer X-Git-Tag: LMDB_0.9.19~49 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=798f020c599310214f4c091beeab56f7e730f3d6;p=openldap Tweak Win32 errmsg buffer --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index d2e81e4e9c..68a2242468 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1417,8 +1417,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) @@ -1450,7 +1451,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);