Skip to content

Commit f727a93

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: CIFS: Fix memory over bound bug in cifs_parse_mount_options
2 parents cd2e49e + 4906e50 commit f727a93

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/cifs/connect.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,7 @@ static int
807807
cifs_parse_mount_options(char *options, const char *devname,
808808
struct smb_vol *vol)
809809
{
810-
char *value;
811-
char *data;
810+
char *value, *data, *end;
812811
unsigned int temp_len, i, j;
813812
char separator[2];
814813
short int override_uid = -1;
@@ -851,6 +850,7 @@ cifs_parse_mount_options(char *options, const char *devname,
851850
if (!options)
852851
return 1;
853852

853+
end = options + strlen(options);
854854
if (strncmp(options, "sep=", 4) == 0) {
855855
if (options[4] != 0) {
856856
separator[0] = options[4];
@@ -916,6 +916,7 @@ cifs_parse_mount_options(char *options, const char *devname,
916916
the only illegal character in a password is null */
917917

918918
if ((value[temp_len] == 0) &&
919+
(value + temp_len < end) &&
919920
(value[temp_len+1] == separator[0])) {
920921
/* reinsert comma */
921922
value[temp_len] = separator[0];

0 commit comments

Comments
 (0)