]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tdb_unpack: Protect against overflow
authorVolker Lendecke <vl@samba.org>
Thu, 4 Oct 2018 09:07:21 +0000 (11:07 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 8 Oct 2018 20:17:09 +0000 (22:17 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/util_tdb.c

index 035daf8b7b77064a52951a94c2c3b0fcfe61b651..9730a030c10c6df71c33cdf5841eeff1bc3116f1 100644 (file)
@@ -227,6 +227,9 @@ int tdb_unpack(const uint8_t *buf, int in_bufsize, const char *fmt, ...)
                                break;
                        }
                        len += *i;
+                       if (len < *i) {
+                               goto no_space;
+                       }
                        if (bufsize < len)
                                goto no_space;
                        *b = (char *)SMB_MALLOC(*i);