You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-misc/mc/files/mc-4.8.3-fix-relative-symli...

40 lines
978 B

Gentoo-bug: https://bugs.gentoo.org/413691
commit 038b5e7406d177792d3e2cd904f6d32e5f392903
Author: Andrew Borodin <aborodin@vmail.ru>
Date: Tue Apr 24 20:41:37 2012 +0400
Ticket #2787: crash when creating relative symlink.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
diff --git a/lib/util.c b/lib/util.c
index 2c6011b..490bdfc 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -112,14 +112,14 @@ is_8bit_printable (unsigned char c)
static char *
resolve_symlinks (const vfs_path_t *vpath)
{
- char *p;
+ char *p, *p2;
char *buf, *buf2, *q, *r, c;
struct stat mybuf;
if (vpath->relative)
return NULL;
- p = vfs_path_to_str (vpath);
+ p = p2 = vfs_path_to_str (vpath);
r = buf = g_malloc (MC_MAXPATHLEN);
buf2 = g_malloc (MC_MAXPATHLEN);
*r++ = PATH_SEP;
@@ -181,7 +181,7 @@ resolve_symlinks (const vfs_path_t *vpath)
ret:
g_free (buf2);
- g_free (p);
+ g_free (p2);
return buf;
}