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

Suresh Jayaraman sjayaraman at suse.de
Wed Apr 22 13:43:17 GMT 2009


Ensure NULL termination (double-byte) is done here and prevent callers
from doing incorrect NULL termination.

Signed-off-by: Suresh Jayaraman <sjayaraman at suse.de>
---
 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;
 }


More information about the linux-cifs-client mailing list