mirror of https://github.com/MidnightCommander/mc
* cmd.c (edit_symlink_cmd): Fix possible off-by-one after
readlink(). * file.c (make_symlink): Likewise. * main.c (copy_readlink): Likewise. * screen.c (display_mini_info): Likewise. (chdir_to_readlink): Likewise. * util.c (resolve_symlinks): Likewise.
This commit is contained in:
parent
ef9371e3fa
commit
8b3b8147d7
|
@ -1,3 +1,13 @@
|
|||
2003-08-29 Andrew V. Samoilov <sav@bcs.zp.ua>
|
||||
|
||||
* cmd.c (edit_symlink_cmd): Fix possible off-by-one after
|
||||
readlink().
|
||||
* file.c (make_symlink): Likewise.
|
||||
* main.c (copy_readlink): Likewise.
|
||||
* screen.c (display_mini_info): Likewise.
|
||||
(chdir_to_readlink): Likewise.
|
||||
* util.c (resolve_symlinks): Likewise.
|
||||
|
||||
2003-08-18 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* cmd.c (delete_cmd_local): New function. Remove file under the
|
||||
|
|
|
@ -1025,7 +1025,7 @@ void edit_symlink_cmd (void)
|
|||
|
||||
q = g_strdup_printf (_(" Symlink `%s\' points to: "), name_trunc (p, 32));
|
||||
|
||||
i = readlink (p, buffer, MC_MAXPATHLEN);
|
||||
i = readlink (p, buffer, MC_MAXPATHLEN - 1);
|
||||
if (i > 0) {
|
||||
buffer [i] = 0;
|
||||
dest = input_expand_dialog (_(" Edit symlink "), q, buffer);
|
||||
|
|
|
@ -366,7 +366,7 @@ make_symlink (FileOpContext *ctx, char *src_path, char *dst_path)
|
|||
dst_is_symlink = 0;
|
||||
|
||||
retry_src_readlink:
|
||||
len = mc_readlink (src_path, link_target, MC_MAXPATHLEN);
|
||||
len = mc_readlink (src_path, link_target, MC_MAXPATHLEN - 1);
|
||||
if (len < 0) {
|
||||
return_status =
|
||||
file_error (_(" Cannot read source link \"%s\" \n %s "),
|
||||
|
|
|
@ -1143,7 +1143,7 @@ copy_readlink (WPanel *panel)
|
|||
concat_dir_and_file (panel->cwd, selection (panel)->fname);
|
||||
int i;
|
||||
|
||||
i = mc_readlink (p, buffer, MC_MAXPATHLEN);
|
||||
i = mc_readlink (p, buffer, MC_MAXPATHLEN - 1);
|
||||
g_free (p);
|
||||
if (i > 0) {
|
||||
buffer[i] = 0;
|
||||
|
|
|
@ -669,7 +669,7 @@ display_mini_info (WPanel *panel)
|
|||
int len;
|
||||
|
||||
link = concat_dir_and_file (panel->cwd, panel->dir.list [panel->selected].fname);
|
||||
len = mc_readlink (link, link_target, MC_MAXPATHLEN);
|
||||
len = mc_readlink (link, link_target, MC_MAXPATHLEN - 1);
|
||||
g_free (link);
|
||||
if (len > 0){
|
||||
link_target[len] = 0;
|
||||
|
@ -2015,7 +2015,7 @@ chdir_to_readlink (WPanel *panel)
|
|||
int i;
|
||||
struct stat st;
|
||||
|
||||
i = readlink (selection (panel)->fname, buffer, MC_MAXPATHLEN);
|
||||
i = readlink (selection (panel)->fname, buffer, MC_MAXPATHLEN - 1);
|
||||
if (i < 0)
|
||||
return;
|
||||
if (mc_stat (selection (panel)->fname, &st) < 0)
|
||||
|
|
|
@ -1069,7 +1069,7 @@ static char *resolve_symlinks (char *path)
|
|||
if (!S_ISLNK (mybuf.st_mode))
|
||||
strcpy (r, p + 1);
|
||||
else {
|
||||
len = mc_readlink (path, buf2, MC_MAXPATHLEN);
|
||||
len = mc_readlink (path, buf2, MC_MAXPATHLEN - 1);
|
||||
if (len < 0) {
|
||||
g_free (buf);
|
||||
g_free (buf2);
|
||||
|
|
Loading…
Reference in New Issue