summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2007-04-12 22:38:54 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2007-04-12 22:38:54 +0000
commit6be615615d538813e3f6dbae46949c1fe9346524 (patch)
tree2ad7a3837e154a536f9a0c5d37a4a857b29bd61e /apps
parent6222b2e693ef3c747e2ea815b4ace2e0ef491e3d (diff)
downloadrockbox-6be615615d538813e3f6dbae46949c1fe9346524.tar.gz
rockbox-6be615615d538813e3f6dbae46949c1fe9346524.zip
Fix sim crashes on long filenames. Patch by Sean Morrisey with some minor changes by me. Fixes FS #6009
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13138 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/onplay.c7
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)
static bool clipboard_clip(bool copy)
{
clipboard_selection[0] = 0;
- strncpy(clipboard_selection, selected_file, MAX_PATH);
+ strncpy(clipboard_selection, selected_file, sizeof(clipboard_selection));
clipboard_selection_attr = selected_file_attr;
clipboard_is_copy = copy;
@@ -780,13 +780,12 @@ static bool clipboard_paste(void)
/* Get the name of the current directory */
cwd = getcwd(NULL, 0);
- snprintf(target, sizeof target, "%s", cwd[1] ? cwd : "");
/* Figure out the name of the selection */
nameptr = strrchr(clipboard_selection, '/');
- /* Paste the name on to the current directory to give us our final target */
- strcat(target, nameptr);
+ /* Final target is current directory plus name of selection */
+ snprintf(target, sizeof(target), "%s%s", cwd[1] ? cwd : "", nameptr);
/* Check if we're going to overwrite */
target_fd = open(target, O_RDONLY);