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
This commit is contained in:
Solomon Peachy 2024-06-20 15:05:58 -04:00
parent 4d0d41a0f4
commit 53a43522a3

View file

@ -378,7 +378,7 @@ static void showinstruments(void)
rb->lcd_clear_display();
for( i=0; i<MAX_LINES && i+vscroll<module->numins; 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();