diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-12-17 22:50:55 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-12-17 22:50:55 (GMT) |
commit | c391c5cbf4631ed63a90962272333fb504ef4e50 (patch) | |
tree | c6bc2e62afdf7024cc87c92a5a48485a4a7e9a17 /Utilities | |
parent | c6089d1642621bf7c8a7042f09094232624652a5 (diff) | |
download | CMake-c391c5cbf4631ed63a90962272333fb504ef4e50.zip CMake-c391c5cbf4631ed63a90962272333fb504ef4e50.tar.gz CMake-c391c5cbf4631ed63a90962272333fb504ef4e50.tar.bz2 |
BUG: fix for bug 5837, libtar and long path names
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmtar/encode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Utilities/cmtar/encode.c b/Utilities/cmtar/encode.c index 1c75954..40b5707 100644 --- a/Utilities/cmtar/encode.c +++ b/Utilities/cmtar/encode.c @@ -93,16 +93,16 @@ th_set_path(TAR *t, char *pathname) if (pathname[strlen(pathname) - 1] != '/' && TH_ISDIR(t)) strcpy(suffix, "/"); - if (strlen(pathname) > T_NAMELEN && (t->options & TAR_GNU)) + if (strlen(pathname)+strlen(suffix) >= T_NAMELEN && (t->options & TAR_GNU)) { /* GNU-style long name */ t->th_buf.gnu_longname = strdup(pathname); strncpy(t->th_buf.name, t->th_buf.gnu_longname, T_NAMELEN); } - else if (strlen(pathname) > T_NAMELEN) + else if (strlen(pathname)+ strlen(suffix) >= T_NAMELEN) { /* POSIX-style prefix field */ - tmp = strchr(&(pathname[strlen(pathname) - T_NAMELEN - 1]), '/'); + tmp = strrchr(pathname, '/'); if (tmp == NULL) { printf("!!! '/' not found in \"%s\"\n", pathname); |