[cmake-commits] hoffman committed encode.c 1.4 1.5
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Dec 17 17:50:57 EST 2007
Update of /cvsroot/CMake/CMake/Utilities/cmtar
In directory public:/mounts/ram/cvs-serv10381
Modified Files:
encode.c
Log Message:
BUG: fix for bug 5837, libtar and long path names
Index: encode.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Utilities/cmtar/encode.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- encode.c 4 Dec 2006 22:26:40 -0000 1.4
+++ encode.c 17 Dec 2007 22:50:55 -0000 1.5
@@ -93,16 +93,16 @@
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);
More information about the Cmake-commits
mailing list