diff options
Diffstat (limited to 'apps/onplay.c')
-rw-r--r-- | apps/onplay.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/apps/onplay.c b/apps/onplay.c index 573511d44d..a92736385c 100644 --- a/apps/onplay.c +++ b/apps/onplay.c | |||
@@ -577,7 +577,7 @@ static bool properties(void) | |||
577 | static bool clipboard_clip(bool copy) | 577 | static bool clipboard_clip(bool copy) |
578 | { | 578 | { |
579 | clipboard_selection[0] = 0; | 579 | clipboard_selection[0] = 0; |
580 | strncpy(clipboard_selection, selected_file, MAX_PATH); | 580 | strncpy(clipboard_selection, selected_file, sizeof(clipboard_selection)); |
581 | clipboard_selection_attr = selected_file_attr; | 581 | clipboard_selection_attr = selected_file_attr; |
582 | clipboard_is_copy = copy; | 582 | clipboard_is_copy = copy; |
583 | 583 | ||
@@ -780,13 +780,12 @@ static bool clipboard_paste(void) | |||
780 | 780 | ||
781 | /* Get the name of the current directory */ | 781 | /* Get the name of the current directory */ |
782 | cwd = getcwd(NULL, 0); | 782 | cwd = getcwd(NULL, 0); |
783 | snprintf(target, sizeof target, "%s", cwd[1] ? cwd : ""); | ||
784 | 783 | ||
785 | /* Figure out the name of the selection */ | 784 | /* Figure out the name of the selection */ |
786 | nameptr = strrchr(clipboard_selection, '/'); | 785 | nameptr = strrchr(clipboard_selection, '/'); |
787 | 786 | ||
788 | /* Paste the name on to the current directory to give us our final target */ | 787 | /* Final target is current directory plus name of selection */ |
789 | strcat(target, nameptr); | 788 | snprintf(target, sizeof(target), "%s%s", cwd[1] ? cwd : "", nameptr); |
790 | 789 | ||
791 | /* Check if we're going to overwrite */ | 790 | /* Check if we're going to overwrite */ |
792 | target_fd = open(target, O_RDONLY); | 791 | target_fd = open(target, O_RDONLY); |