* file.c (make_symlink): Use g_strlcpy() instead of strcpy().

This commit is contained in:
Andrew V. Samoilov 2004-11-03 19:49:24 +00:00
parent cee8133838
commit 611114d735
2 changed files with 12 additions and 7 deletions

View File

@ -1,3 +1,7 @@
2004-11-03 Andrew V. Samoilov <sav@bcs.zp.ua>
* file.c (make_symlink): Use g_strlcpy() instead of strcpy().
2004-11-03 Jindrich Novy <jnovy@redhat.com>
* subshell.c (do_subshell_chdir): Filter out a possible password from

View File

@ -379,11 +379,10 @@ make_symlink (FileOpContext *ctx, const char *src_path, const char *dst_path)
if (ctx->stable_symlinks && *link_target != PATH_SEP) {
char *p, *q, *r, *s;
p = g_strdup (src_path);
r = strrchr (p, PATH_SEP);
r = strrchr (src_path, PATH_SEP);
if (r) {
r[1] = 0;
p = g_strndup (src_path, r - src_path);
if (*dst_path == PATH_SEP)
q = g_strdup (dst_path);
else
@ -392,17 +391,19 @@ make_symlink (FileOpContext *ctx, const char *src_path, const char *dst_path)
if (r) {
r[1] = 0;
s = g_strconcat (p, link_target, (char *) NULL);
strcpy (link_target, s);
g_free (p);
g_strlcpy (link_target, s, sizeof (link_target));
g_free (s);
s = diff_two_paths (q, link_target);
if (s) {
strcpy (link_target, s);
g_strlcpy (link_target, s, sizeof (link_target));
g_free (s);
}
}
} else
g_free (p);
g_free (q);
}
g_free (p);
}
retry_dst_symlink:
if (mc_symlink (link_target, dst_path) == 0)