Skip to content

Commit 8cd91d6

Browse files
Fix
1 parent 4688ebc commit 8cd91d6

2 files changed

Lines changed: 2 additions & 9 deletions

File tree

examples/sftpclient/sftpclient.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,14 +465,14 @@ static int sftpParseModeAndPath(char* pt, char* modeBuf, char** pathOut,
465465

466466
sz = (sz < WOLFSSH_MAX_OCTET_LEN - 1) ? sz : WOLFSSH_MAX_OCTET_LEN - 1;
467467
WMEMCPY(modeBuf, pt, sz);
468-
modeBuf[WOLFSSH_MAX_OCTET_LEN - 1] = '\0';
468+
modeBuf[sz] = '\0';
469469
for (idx = 0; idx < sz; idx++) {
470470
if (modeBuf[idx] == ' ') {
471471
modeBuf[idx] = '\0';
472472
break;
473473
}
474474
}
475-
if (idx == 0)
475+
if (idx == 0 || (idx == sz && pt[sz] != ' '))
476476
return 1;
477477

478478
pt += (word32)WSTRLEN(modeBuf);

tests/sftp.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,6 @@ static int checkCreatStripsSpecialBits(void)
192192
"mode=%06o\n", (unsigned)(st.st_mode & 07777));
193193
return 1;
194194
}
195-
/* creat 04755 -> safe mode 0755; owner r+w must survive any umask */
196-
if ((st.st_mode & 0600) != 0600) {
197-
fprintf(stderr,
198-
"WOLFSSH_SFTP_SAFE_MODE (RecvOpen): unexpected mode=%06o, "
199-
"want at least 0600\n", (unsigned)(st.st_mode & 07777));
200-
return 1;
201-
}
202195
return 0;
203196
}
204197
#endif /* !USE_WINDOWS_API && !WOLFSSH_FATFS && !WOLFSSH_ZEPHYR */

0 commit comments

Comments
 (0)