[PATCH 2/5] cifs: Fix cifs_strfromUCS_le to do double-byte NULL termination

Suresh Jayaraman <[email protected]>
Newsgroups gmane.linux.file-systems.cifs
Message-ID <[email protected]>
Ensure NULL termination (double-byte) is done here and prevent callers
from doing incorrect NULL termination.

Signed-off-by: Suresh Jayaraman <[email protected]>
---
 fs/cifs/cifs_unicode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c
index 7d75272..e7ed048 100644
--- a/fs/cifs/cifs_unicode.c
+++ b/fs/cifs/cifs_unicode.c
@@ -51,6 +51,8 @@ cifs_strfromUCS_le(char *to, const __le16 *from,
 		}
 	}
 	to[outlen] = 0;
+	/* ensure double-byte NULL termination */
+	to[outlen + 1] = 0;
 	return outlen;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.