diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-06-20 15:05:58 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-06-20 15:16:22 -0400 |
commit | 53a43522a367b2592e0e1a52383f0326434962d5 (patch) | |
tree | 1735f450fb461aebccb2c09bf936a7a60a4e9300 | |
parent | 4d0d41a0f434842636a65b3bb230b83c2c5c50b1 (diff) | |
download | rockbox-53a43522a367b2592e0e1a52383f0326434962d5.tar.gz rockbox-53a43522a367b2592e0e1a52383f0326434962d5.zip |
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
-rw-r--r-- | apps/plugins/mikmod/mikmod.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
378 | rb->lcd_clear_display(); | 378 | rb->lcd_clear_display(); |
379 | for( i=0; i<MAX_LINES && i+vscroll<module->numins; i++ ) | 379 | for( i=0; i<MAX_LINES && i+vscroll<module->numins; i++ ) |
380 | { | 380 | { |
381 | sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname); | 381 | sprintf(statustext, "%02d %s", i+vscroll+1, module->instruments[i+vscroll].insname ? module->instruments[i+vscroll].insname : "[n/a]"); |
382 | rb->lcd_putsxy(1, 1+(8*i), statustext); | 382 | rb->lcd_putsxy(1, 1+(8*i), statustext); |
383 | } | 383 | } |
384 | rb->lcd_update(); | 384 | rb->lcd_update(); |