From d22d533616082a67dbf7a889a5adaa841a079a60 Mon Sep 17 00:00:00 2001 From: gullradriel Date: Mon, 9 Feb 2026 21:08:38 +0100 Subject: [PATCH] fix potential UB with conversion --- protopirate_app_i.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/protopirate_app_i.c b/protopirate_app_i.c index d932d80..597c8f1 100644 --- a/protopirate_app_i.c +++ b/protopirate_app_i.c @@ -66,11 +66,9 @@ void protopirate_get_frequency_modulation( FuriString* modulation) { furi_assert(app); if(frequency != NULL) { - furi_string_printf( - frequency, - "%03ld.%02ld", - app->txrx->preset->frequency / 1000000 % 1000, - app->txrx->preset->frequency / 10000 % 100); + unsigned long mhz = (unsigned long)((app->txrx->preset->frequency / 1000000UL) % 1000UL); + unsigned long khz = (unsigned long)((app->txrx->preset->frequency / 10000UL) % 100UL); + furi_string_printf(frequency, "%03lu.%02lu", mhz, khz); } if(modulation != NULL) { furi_string_printf(modulation, "%.2s", furi_string_get_cstr(app->txrx->preset->name));