From a94c011b4e452273912f4124e0bf6a80396b8f67 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 3 Jun 2011 16:15:49 +0000 Subject: [PATCH] Fix more FTP bugs git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3664 42af7a65-404d-4744-a932-0658087f49c3 --- netutils/ftpc/ftpc_filetime.c | 3 ++- netutils/ftpc/ftpc_pwd.c | 10 ++++++++-- netutils/ftpc/ftpc_utils.c | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/netutils/ftpc/ftpc_filetime.c b/netutils/ftpc/ftpc_filetime.c index a9558f22d..6b3a1d6db 100644 --- a/netutils/ftpc/ftpc_filetime.c +++ b/netutils/ftpc/ftpc_filetime.c @@ -74,7 +74,8 @@ * Name: ftpc_filetime * * Descripton: - * Return the timestamp on the remote file. + * Return the timestamp on the remote file. Returned time is UTC + * (Universal Coordinated Time). * ****************************************************************************/ diff --git a/netutils/ftpc/ftpc_pwd.c b/netutils/ftpc/ftpc_pwd.c index 809002c9b..e8cfaef70 100644 --- a/netutils/ftpc/ftpc_pwd.c +++ b/netutils/ftpc/ftpc_pwd.c @@ -113,9 +113,15 @@ FAR char *ftpc_pwd(SESSION handle) return NULL; } - /* Allocate memory for the path name */ + /* Allocate memory for the path name: + * + * Reply: 257 "/home/gnutt" + * ^start ^end + * + * len = end - start + 1 = 11 (+ NUL terminator) + */ - len = end - start; + len = end - start + 1; pwd = (char *)malloc(len + 1); if (!pwd) { diff --git a/netutils/ftpc/ftpc_utils.c b/netutils/ftpc/ftpc_utils.c index 45994532e..9692cae4f 100644 --- a/netutils/ftpc/ftpc_utils.c +++ b/netutils/ftpc/ftpc_utils.c @@ -182,7 +182,7 @@ void ftpc_stripslash(FAR char *str) if (len > 1) { ptr = str + len - 1; - if (*ptr == '/'); + if (*ptr == '/') { *ptr = '\0'; }