From 9882d983b934752d525ca59b29e8a9873b60ee84 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sun, 17 Jun 2012 12:56:32 +0200 Subject: [PATCH] Avoiding to print a NULL pointer via %s in a HFS+ debug message --- libisofs/hfsplus.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libisofs/hfsplus.c b/libisofs/hfsplus.c index 0b810d1..3dcbca7 100644 --- a/libisofs/hfsplus.c +++ b/libisofs/hfsplus.c @@ -674,8 +674,17 @@ int hfsplus_writer_write_data(IsoImageWriter *writer) for (j = 0; j < t->hfsp_levels[level].nodes[i].cnt; j++) { iso_msb ((uint8_t *) buffer + HFSPLUS_CAT_NODE_SIZE - j * 2 - 2, curoff, 2); - iso_msg_debug(t->image->id, "%d out of %d, %s", (int) curnode, t->hfsp_nleafs, - t->hfsp_leafs[curnode].node->name); + if (t->hfsp_leafs[curnode].node->name == NULL) + { + iso_msg_debug(t->image->id, "%d out of %d", + (int) curnode, t->hfsp_nleafs); + } + else + { + iso_msg_debug(t->image->id, "%d out of %d, %s", + (int) curnode, t->hfsp_nleafs, + t->hfsp_leafs[curnode].node->name); + } switch (t->hfsp_leafs[curnode].type) {