Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support large file sizes in long file names. #548

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/wolfsftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2448,6 +2448,7 @@ static void getDate(char* buf, int len, struct tm* t)
* return WS_SUCCESS on success */
static int SFTP_CreateLongName(WS_SFTPNAME* name)
{
char sizeStr[32];
char perm[11];
int linkCount = 1; /* @TODO set to correct value */
#if defined(XGMTIME) && defined(XSNPRINTF)
Expand Down Expand Up @@ -2501,7 +2502,9 @@ static int SFTP_CreateLongName(WS_SFTPNAME* name)

totalSz += name->fSz; /* size of file name */
totalSz += 7; /* for all ' ' spaces */
totalSz += 3 + 8 + 8 + 8; /* linkCount + uid + gid + size */
totalSz += 3 + 8 + 8; /* linkCount + uid + gid */
WSNPRINTF(sizeStr, sizeof(sizeStr) - 1, "%8lld", ((long long int)atr->sz[1] << 32) + (long long int)(atr->sz[0]));
totalSz += WSTRLEN(sizeStr);
#else
totalSz = name->fSz;
#endif
Expand All @@ -2515,8 +2518,8 @@ static int SFTP_CreateLongName(WS_SFTPNAME* name)
name->lName[totalSz] = '\0';

#if defined(XGMTIME) && defined(XSNPRINTF)
WSNPRINTF(name->lName, totalSz, "%s %3d %8d %8d %8d %s %s",
perm, linkCount, atr->uid, atr->gid, atr->sz[0], date, name->fName);
WSNPRINTF(name->lName, totalSz, "%s %3d %8d %8d %s %s %s",
perm, linkCount, atr->uid, atr->gid, sizeStr, date, name->fName);
#else
WMEMCPY(name->lName, name->fName, totalSz);
#endif
Expand Down
Loading