[linux-cifs-client] [PATCH 4/5] cifs: Fix buffer size in cifs_convertUCSpath and add a missing overrun check

Suresh Jayaraman sjayaraman at suse.de
Wed May 6 11:33:33 GMT 2009


From: Suresh Jayaraman <sjayaraman at suse.de>
Subject: Fix buffer size in cifs_convertUCSpath and add a missing overrun check

Reported-by: Jeff Layton <jlayton at redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman at suse.de>
---
 fs/cifs/misc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6.29.2/fs/cifs/misc.c
===================================================================
--- linux-2.6.29.2.orig/fs/cifs/misc.c
+++ linux-2.6.29.2/fs/cifs/misc.c
@@ -691,14 +691,15 @@ cifs_convertUCSpath(char *target, const
 						NLS_MAX_CHARSET_SIZE);
 				if (len > 0) {
 					j += len;
-					continue;
+					goto overrun_chk;
 				} else {
 					target[j] = '?';
 				}
 		}
 		j++;
 		/* make sure we do not overrun callers allocated temp buffer */
-		if (j >= (2 * NAME_MAX))
+overrun_chk:
+		if (j >= UNICODE_NAME_MAX)
 			break;
 	}
 cUCS_out:


More information about the linux-cifs-client mailing list