Author Topic: FTP client creating random directories  (Read 5182 times)

Offline mark

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3234
    • View Profile
    • uTasker
FTP client creating random directories
« on: August 24, 2011, 03:40:49 PM »
Hi All

This is a follow-up to the following thread: http://www.utasker.com/forum/index.php?topic=1660.0

After analysis of the FTP client's behaviour it was seen that it would create a directory using the command "MKD /". I don't know why it does this but it was the cause of the problem due to the following:
-  FTP sends the data "MKD /<cr><lf>"
- The utFAT interface already accepts the carriage-return of line feeds as indicating the end of a string so that it is compatible with general FTP operation but the fact that '/' was followed immediately by the termination was causing a random directly name to be understood. The '/' is generally ignored since it is not a part of the name but determining the location on the disk. In this case the line termination seems to indicate a directory without any name, but this was being jumped and the content of the reception Ethernet buffer was read to determine the name, whereby the Ethernet reception buffer contains random-like data since it depends on what it last received .

Since the command to create a directory without a name doesn't seem to make a lot of sense it was decided to catch this case and return an error UTFAT_INVALID_NAME. This in turn causes the FTP interface to respond with MSG_FTP_DENIED when the FTP client sends this command.

See modification
24.08.2011 Recognise empty file names and reject them                {37}
in utFAT1.10: http://www.utasker.com/forum/index.php?topic=1667.0

Regards

Mark