diff -bur samba-3.0.0rc2.orig/source/client/clitar.c samba-3.0.0rc2/source/client/clitar.c --- samba-3.0.0rc2.orig/source/client/clitar.c Thu Aug 28 14:42:42 2003 +++ samba-3.0.0rc2/source/client/clitar.c Sun Aug 31 20:19:14 2003 @@ -185,18 +185,20 @@ i = strlen(b)+1; DEBUG(5, ("File name in tar file: %s, size=%d, \n", b, (int)strlen(b))); dotarbuf(f, b, TBLOCK*(((i-1)/TBLOCK)+1)); + /* copy the truncated, fixed, name into hb.dbuf.name */ + strncpy(hb.dbuf.name, b, NAMSIZ); SAFE_FREE(b); + } else { + fixtarname(hb.dbuf.name, aname, l); } - - /* use l + 1 to do the null too */ - fixtarname(hb.dbuf.name, aname, (l >= NAMSIZ) ? NAMSIZ : l + 1); + /* strncpy above doesn't terminate the string */ + hb.dbuf.name[NAMSIZ-1]='\0'; if (lowercase) strlower_m(hb.dbuf.name); /* write out a "standard" tar format header */ - hb.dbuf.name[NAMSIZ-1]='\0'; safe_strcpy(hb.dbuf.mode, amode, sizeof(hb.dbuf.mode)-1); oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.uid); oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.gid);