[rtems commit] tftpDriver: don't free directory node's path string

Sebastian Huber sebh at rtems.org
Thu Jan 26 06:42:28 UTC 2017


Module:    rtems
Branch:    4.10
Commit:    aecb508673df0d047e055f452e3f2d9db17328c0
Changeset: http://git.rtems.org/rtems/commit/?id=aecb508673df0d047e055f452e3f2d9db17328c0

Author:    Michael Davidsaver <mdavidsaver at gmail.com>
Date:      Sun Jul 26 09:28:07 2015 -0400

tftpDriver: don't free directory node's path string

Update #2375.

---

 cpukit/libnetworking/lib/tftpDriver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libnetworking/lib/tftpDriver.c b/cpukit/libnetworking/lib/tftpDriver.c
index 9d04025..d93ef31 100644
--- a/cpukit/libnetworking/lib/tftpDriver.c
+++ b/cpukit/libnetworking/lib/tftpDriver.c
@@ -512,8 +512,9 @@ static int rtems_tftp_eval_path(
         size_t pathlen = pathnamelen;
         size_t len = currentlen + pathlen;
 
-        current = realloc (current, len + 1);
+        current = malloc (len + 1);
         if (current != NULL) {
+            memcpy (current, currentloc->node_access, currentlen);
             memcpy (current + currentlen, path, pathlen);
             current [len] = '\0';
             if (!rtems_tftp_is_directory (current, len)) {



More information about the vc mailing list