fix nfs symlink name corruption
authorEd Swarthout <Ed.Swarthout@freescale.com>
Thu, 19 Nov 2009 08:47:28 +0000 (02:47 -0600)
committerWolfgang Denk <wd@denx.de>
Mon, 7 Dec 2009 20:50:19 +0000 (21:50 +0100)
An off by one error may cause nfs readlink lookup fail if
nfs_path_buff has non-zero data from a previous use.

Loading: *** ERROR: File lookup fail

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
net/nfs.c

index 27395fbf2e4b7068dc0de94d7f2df7f3118696f3..c39f616d9ba98b7f0686bd8f4304d7d066090be5 100644 (file)
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -516,7 +516,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len)
                strcat (nfs_path, "/");
                pathlen = strlen(nfs_path);
                memcpy (nfs_path+pathlen, (uchar *)&(rpc_pkt.u.reply.data[2]), rlen);
-               nfs_path[pathlen+rlen+1] = 0;
+               nfs_path[pathlen + rlen] = 0;
        } else {
                memcpy (nfs_path, (uchar *)&(rpc_pkt.u.reply.data[2]), rlen);
                nfs_path[rlen] = 0;