From 2c3c1c7bb83455e09ed3b5724b288c50a8ddf784 Mon Sep 17 00:00:00 2001 From: Steve Karg Date: Sat, 13 Dec 2025 11:50:22 -0600 Subject: [PATCH] Fixed NULL handling in CharacterString sprintf which caused endless loop. (#1189) --- CHANGELOG.md | 2 ++ src/bacnet/bacapp.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 398424ea..6bd82b5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,6 +63,8 @@ The git repositories are hosted at the following sites: ### Fixed +* Fixed NULL handling in CharacterString sprintf which caused an endless + loop. (#1189) * Fixed a regression in the rpm_ack_object_property_process() function that prevented proper parsing of multi-object ReadPropertyMultiple ACK responses. The bug was introduced in PR [#765] and caused the function diff --git a/src/bacnet/bacapp.c b/src/bacnet/bacapp.c index 19a6984c..5588b8cb 100644 --- a/src/bacnet/bacapp.c +++ b/src/bacnet/bacapp.c @@ -2099,6 +2099,10 @@ int bacapp_snprintf_character_string( retry with the next one. */ wclen = 1; wc = L'?'; + } else if (wclen == 0) { + /* Null wide character */ + wc = L'.'; + wclen = 1; } else { if (!iswprint(wc)) { wc = L'.';