From d6223677bfded0aed659df4a78f318ffc180003c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 16 Oct 2019 15:27:49 +0200 Subject: dbwrap_tdb: Avoid a use of talloc_stackframe() For really large keys (that probably don't exist), use dump_data() Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- lib/dbwrap/dbwrap_tdb.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib/dbwrap') diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index eb08a01a161..1ac7dc9ed7a 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -42,24 +42,24 @@ static NTSTATUS db_tdb_delete(struct db_record *rec); static void db_tdb_log_key(const char *prefix, TDB_DATA key) { - size_t len; - char *keystr; - TALLOC_CTX *frame; if (DEBUGLEVEL < 10) { return; } - frame = talloc_stackframe(); - len = key.dsize; if (DEBUGLEVEL == 10) { /* * Only fully spam at debuglevel > 10 */ - len = MIN(10, key.dsize); + key.dsize = MIN(10, key.dsize); } - keystr = hex_encode_talloc(frame, (unsigned char *)(key.dptr), - len); - DBG_DEBUG("%s key %s\n", prefix, keystr); - TALLOC_FREE(frame); + + if (key.dsize < 1024) { + char keystr[key.dsize*2+1]; + hex_encode_buf(keystr, key.dptr, key.dsize); + DBG_DEBUG("%s key %s\n", prefix, keystr); + return; + } + + dump_data(DEBUGLEVEL, key.dptr, key.dsize); } static int db_tdb_record_destr(struct db_record* data) -- cgit v1.2.1