From 53a43522a367b2592e0e1a52383f0326434962d5 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 20 Jun 2024 15:05:58 -0400 Subject: mikmod: Fix null pointer dereference in mikmod plugin While playing, the user can switch between status/samples/instruments/comments screens. The instrument names are blindly passed to printf, which will lead to a null pointer dereference if the instrument name is NULL. ...Which happens with some .IT modules that I have. This should arguably be fixed in the printf implementation, but we still shouldn't be passing in NULLs as string arguments! Change-Id: I2899e2f7e10565c251e495752b3ef1bbccea82c7 --- apps/plugins/mikmod/mikmod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/plugins/mikmod/mikmod.c b/apps/plugins/mikmod/mikmod.c index 30f8c2f079..6b08fa258b 100644 --- a/apps/plugins/mikmod/mikmod.c +++ b/apps/plugins/mikmod/mikmod.c @@ -378,7 +378,7 @@ static void showinstruments(void) rb->lcd_clear_display(); for( i=0; inumins; i++ ) { - sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname); + sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname ? module->instruments[i+vscroll].insname : "[n/a]"); rb->lcd_putsxy(1, 1+(8*i), statustext); } rb->lcd_update(); -- cgit v1.2.3