]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
cifs: Fix buffer size in cifs_convertUCSpath
authorSuresh Jayaraman <sjayaraman@suse.de>
Sat, 9 May 2009 06:03:12 +0000 (11:33 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 20 May 2009 05:20:13 +0000 (22:20 -0700)
Relevant commits 7fabf0c9479fef9fdb9528a5fbdb1cb744a744a4 and
f58841666bc22e827ca0dcef7b71c7bc2758ce82. The upstream commits adds
cifs_from_ucs2 that includes functionality of cifs_convertUCSpath and
does cleanup.

Reported-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: Steve French <sfrench@us.ibm.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/misc.c

index b89155335f7475677473d8ad811e97dc6c304efc..62055938a1436f9635c14b9a4b4f551f12867fe0 100644 (file)
@@ -685,14 +685,15 @@ cifs_convertUCSpath(char *target, const __le16 *source, int maxlen,
                                                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: