Browse Source

Merge pull request #42 from tjrong/master

修正tftp_server 路径名分配长度少1个字节的bug
朱天龙 (Armink) 6 years ago
parent
commit
9c7a6451fd
1 changed files with 2 additions and 1 deletions
  1. 2 1
      tftp/tftp_server.c

+ 2 - 1
tftp/tftp_server.c

@@ -6,6 +6,7 @@
  * Change Logs:
  * Date           Author       Notes
  * 2019-02-26     tyx          first implementation
+ * 2019-11-18     tjrong       fix a bug in tftp_server_request_handle.
  */
 
 #include <stdio.h>
@@ -375,7 +376,7 @@ static struct tftp_client_xfer *tftp_server_request_handle(struct tftp_server *s
         }
     }
     /* Get full file path */
-    name_len = strlen(path) + strlen(server->root_name);
+    name_len = strlen(path) + strlen(server->root_name) + 1;
     if (name_len >= TFTP_SERVER_FILE_NAME_MAX)
     {
         tftp_printf("file name is to long!!\n");