]> git.sur5r.net Git - openldap/commitdiff
Merge remote-tracking branch 'origin/mdb.RE/0.9'
authorQuanah Gibson-Mount <quanah@openldap.org>
Mon, 23 Mar 2015 16:14:16 +0000 (11:14 -0500)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 23 Mar 2015 16:14:16 +0000 (11:14 -0500)
libraries/liblmdb/CHANGES
libraries/liblmdb/mdb_load.c

index 90dbba26a248833d92942a4e394afbc1f5256f84..cf12f2eebdc7a6be9724aa50eefd7e713b03248e 100644 (file)
@@ -4,6 +4,7 @@ LMDB 0.9.15 Release Engineering
        Fix txn init (ITS#7961,#7987)
        Fix MDB_PREV_DUP (ITS#7955,#7671)
        Fix compact of empty env (ITS#7956)
+       Fix mdb_load with large values (ITS#8066)
        Added workaround for fdatasync bug in ext3fs
        Build
                Don't use -fPIC for static lib
index f6266923b5127d2bc7708547c356cd3094deff7e..1f6ce0b7ecae75da54d2f2fa42d7897487a461ec 100644 (file)
@@ -176,7 +176,7 @@ static int unhex(unsigned char *c2)
 static int readline(MDB_val *out, MDB_val *buf)
 {
        unsigned char *c1, *c2, *end;
-       size_t len;
+       size_t len, l2;
        int c;
 
        if (!(mode & NOHDR)) {
@@ -206,6 +206,7 @@ badend:
 
        c1 = buf->mv_data;
        len = strlen((char *)c1);
+       l2 = len;
 
        /* Is buffer too short? */
        while (c1[len-1] != '\n') {
@@ -217,17 +218,18 @@ badend:
                        return EOF;
                }
                c1 = buf->mv_data;
-               c1 += buf->mv_size;
-               if (fgets((char *)c1, buf->mv_size, stdin) == NULL) {
+               c1 += l2;
+               if (fgets((char *)c1, buf->mv_size+1, stdin) == NULL) {
                        Eof = 1;
                        badend();
                        return EOF;
                }
                buf->mv_size *= 2;
                len = strlen((char *)c1);
+               l2 += len;
        }
        c1 = c2 = buf->mv_data;
-       len = strlen((char *)c1);
+       len = l2;
        c1[--len] = '\0';
        end = c1 + len;