diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-11-14 10:01:14 -0500 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2022-11-15 00:56:01 -0400 |
commit | b25a9d8f99b75570d18ea64602de7fe48da612d6 (patch) | |
tree | f9d4217317e9a6e44d79e6fbf4fcbf7355932f93 /apps/playlist_viewer.c | |
parent | 034b6d5bfb5bdedaf843079a02ff6df31488f394 (diff) | |
download | rockbox-b25a9d8f99b75570d18ea64602de7fe48da612d6.tar.gz rockbox-b25a9d8f99b75570d18ea64602de7fe48da612d6.zip |
add memccpy.c
Not sure if this is worth the added bin size yet but I will
see where I can use it to try and make it worth it
Change-Id: Icc299d3986172ff224a14be48da3bf065d728a66
Diffstat (limited to 'apps/playlist_viewer.c')
-rw-r--r-- | apps/playlist_viewer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c index d2774e67b0..f1f8954113 100644 --- a/apps/playlist_viewer.c +++ b/apps/playlist_viewer.c | |||
@@ -516,7 +516,10 @@ static enum pv_onplay_result open_with(const struct playlist_entry *current_trac | |||
516 | { | 516 | { |
517 | char selected_track[MAX_PATH]; | 517 | char selected_track[MAX_PATH]; |
518 | close_playlist_viewer(); | 518 | close_playlist_viewer(); |
519 | snprintf(selected_track, sizeof(selected_track), "%s", current_track->name); | 519 | |
520 | if (!memccpy (selected_track, current_track->name, '\0', sizeof(selected_track))) | ||
521 | selected_track[sizeof(selected_track) - 1] = '\0'; | ||
522 | |||
520 | 523 | ||
521 | return (filetype_list_viewers(selected_track) == | 524 | return (filetype_list_viewers(selected_track) == |
522 | PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED); | 525 | PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED); |
@@ -528,7 +531,9 @@ static enum pv_onplay_result open_pictureflow(const struct playlist_entry *curre | |||
528 | { | 531 | { |
529 | char selected_track[MAX_PATH]; | 532 | char selected_track[MAX_PATH]; |
530 | close_playlist_viewer(); | 533 | close_playlist_viewer(); |
531 | snprintf(selected_track, sizeof(selected_track), "%s", current_track->name); | 534 | |
535 | if (!memccpy (selected_track, current_track->name, '\0', sizeof(selected_track))) | ||
536 | selected_track[sizeof(selected_track) - 1] = '\0'; | ||
532 | 537 | ||
533 | return (filetype_load_plugin((void *)"pictureflow", selected_track) == | 538 | return (filetype_load_plugin((void *)"pictureflow", selected_track) == |
534 | PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED); | 539 | PLUGIN_USB_CONNECTED ? PV_ONPLAY_USB_CLOSED : PV_ONPLAY_CLOSED); |