From 4953fa99e78ce86e98c18d438dac00669956965c Mon Sep 17 00:00:00 2001
From: John Thacker <johnthacker@gmail.com>
Date: Thu, 23 Nov 2023 13:47:51 -0500
Subject: [PATCH] gvcp: Don't try to add a NULL string to a column

Origin: https://gitlab.com/wireshark/wireshark/-/merge_requests/13417

This was caught as an invalid argument by g_strlcpy before 4.2,
but it was never a good idea.

Fix #19496

(backported from commit a8586fde3a6512466afb2a660538ef3fe712076b)
---
 epan/dissectors/packet-gvcp.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/epan/dissectors/packet-gvcp.c b/epan/dissectors/packet-gvcp.c
index a7c13684f03..732db590e4a 100644
--- a/epan/dissectors/packet-gvcp.c
+++ b/epan/dissectors/packet-gvcp.c
@@ -2222,15 +2222,12 @@ static void dissect_readreg_ack(proto_tree *gvcp_telegram_tree, tvbuff_t *tvb, p
 			if (addr_list_size > 0)
 			{
 				address_string = get_register_name_from_address(*((guint32*)wmem_array_index(gvcp_trans->addr_list, 0)), gvcp_info, &is_custom_register);
+				col_append_str(pinfo->cinfo, COL_INFO, address_string);
 			}
 
 			if (num_registers)
 			{
-				col_append_fstr(pinfo->cinfo, COL_INFO, "%s Value=0x%08X", address_string, tvb_get_ntohl(tvb, offset));
-			}
-			else
-			{
-				col_append_str(pinfo->cinfo, COL_INFO, address_string);
+				col_append_sep_fstr(pinfo->cinfo, COL_INFO, " ", "Value=0x%08X", tvb_get_ntohl(tvb, offset));
 			}
 		}
 	}
-- 
GitLab

