From 5ec273e81deb2b3bf73aa76c9d1d07508e5117ce Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 14 Oct 2022 21:54:06 +0200 Subject: [PATCH] Update snmp-ups.c Avoid potential NULL pointer dereference in a debug printout --- drivers/snmp-ups.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index 6c95443cd8..20a983eb5e 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -2294,7 +2294,8 @@ static int base_snmp_template_index(const snmp_info_t *su_info_p) char test_OID[SU_INFOSIZE]; snmp_info_flags_t template_type = get_template_type(su_info_p->info_type); - upsdebugx(3, "%s: OID template = %s", __func__, su_info_p->OID); + upsdebugx(3, "%s: OID template = %s", __func__, + (su_info_p->OID ? su_info_p->OID : "") ); /* Try to differentiate between template types which may have * different indexes ; and store it to not redo it again */