From 22c379a6119a275b506cbc8ae9a4208ea84c5042 Mon Sep 17 00:00:00 2001 From: Christian Ehrhardt Date: Thu, 30 Sep 2021 09:50:19 +0200 Subject: [PATCH] Fix gcc-11 error "directive argument is null" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mdbtools triggered In function ‘printf’, inlined from ‘mdb_dump_catalog’ at catalog.c:195:4: /usr/include/powerpc64le-linux-gnu/bits/stdio2.h:112:10: error: ‘%-12s’ directive argument is null [-Werror=format-overflow=] 112 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ()); This is due to mdb_get_objtype_string potentially returning NULL which isn't allowed anymore as it would cause a segfault on the latter print. Fixes: #352 Signed-off-by: Christian Ehrhardt --- src/libmdb/catalog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libmdb/catalog.c b/src/libmdb/catalog.c index 13ecac0..9239be2 100644 --- a/src/libmdb/catalog.c +++ b/src/libmdb/catalog.c @@ -193,7 +193,7 @@ mdb_dump_catalog(MdbHandle *mdb, int obj_type) entry = g_ptr_array_index(mdb->catalog,i); if (obj_type==MDB_ANY || entry->object_type==obj_type) { printf("Type: %-12s Name: %-48s Page: %06lx\n", - mdb_get_objtype_string(entry->object_type), + mdb_get_objtype_string(entry->object_type) ?: "Unknown", entry->object_name, entry->table_pg); }