[PATCH 4/5] cifs: Fix buffer size in cifs_convertUCSpath and add a missing overrun check
Suresh Jayaraman <[email protected]>
| Newsgroups | gmane.linux.file-systems.cifs |
|---|---|
| Message-ID | <[email protected]> |
From: Suresh Jayaraman <[email protected]> Subject: Fix buffer size in cifs_convertUCSpath and add a missing overrun check Reported-by: Jeff Layton <[email protected]> Signed-off-by: Suresh Jayaraman <[email protected]> --- 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: