Skip to contentSkip to conversation

CIFS: Fix IP address bounds checking on mount utility.

PATCH In review [email protected] 2 participants 5 messages Nov 21, 2012 – Nov 24, 2012 5 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CIFS: Fix IP address bounds checking on mount utility.

From: Scott Lovenberg <[email protected]>

---
 mount.cifs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mount.cifs.c +2 -2
index a9632b4..f63c309 100644
@@ -941,8 +941,8 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 			if (!value || !*value) {
 				fprintf(stderr,
 					"target ip address argument missing\n");
-			} else if (strnlen(value, MAX_ADDRESS_LEN) <=
-				MAX_ADDRESS_LEN) {
+			} else if (strnlen(value, MAX_ADDR_LIST_LEN + 1) <=
+				MAX_ADDR_LIST_LEN) {
 				strcpy(parsed_info->addrlist, value);
 				if (parsed_info->verboseflag)
 					fprintf(stderr,
Signature · 1 line
1.7.5.4

A message that is not in the archive (sent off-list or not yet received): 1353528652-8912-1-git-send-email-scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 24 lines · On Wed, Nov 21, 2012 at 3:10 PM, <scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public…

From: Scott Lovenberg <[email protected]>

---
 mount.cifs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mount.cifs.c +2 -3
index a9632b4..f63c309 100644
@@ -941,8 +941,8 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
                        if (!value || !*value) {
                                fprintf(stderr,
                                        "target ip address argument missing\n");
-                       } else if (strnlen(value, MAX_ADDRESS_LEN) <=
-                               MAX_ADDRESS_LEN) {
+                       } else if (strnlen(value, MAX_ADDR_LIST_LEN + 1) <=
+                               MAX_ADDR_LIST_LEN) {
                                strcpy(parsed_info->addrlist, value);
                                if (parsed_info->verboseflag)
                                        fprintf(stderr,
--
Quoted 2 lines

1.7.5.4

I still suck at git send-email. The body of that should have read:
"In the mount utility use MAX_ADDR_LIST_LEN for bounds checking on ip addresses instead of MAX_ADDRESS_LEN. Parsed_mount_info->addrlist is MAX_ADDR_LIST_LEN chars long."

--
Peace and Blessings,
-Scott.

A message that is not in the archive (sent off-list or not yet received): CAOhYWN+Xq5hhPJ1fEQg2AN=UM8k7N22Tfwo424a145KpK0AKDw@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CAOhYWN+Xq5hhPJ1fEQg2AN=UM8k7N22Tfwo424a145KpK0AKDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw
Quoted 48 lines · Jeff Layton
Quoted 37 lines · Scott Lovenberg
Quoted 22 lines · On Wed, Nov 21, 2012 at 3:10 PM, <scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public…

From: Scott Lovenberg <[email protected]>

---
 mount.cifs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mount.cifs.c +1 -2
index a9632b4..f63c309 100644
@@ -941,8 +941,8 @@ parse_options(const char *data, struct
 parsed_mount_info *parsed_info)
                        if (!value || !*value) {
                                fprintf(stderr,
                                        "target ip address argument
 missing\n");
-                       } else if (strnlen(value, MAX_ADDRESS_LEN) <=
-                               MAX_ADDRESS_LEN) {
+                       } else if (strnlen(value, MAX_ADDR_LIST_LEN + 1)

<=

Quoted 7 lines
+                               MAX_ADDR_LIST_LEN) {
                                strcpy(parsed_info->addrlist, value);
                                if (parsed_info->verboseflag)
                                        fprintf(stderr,

--
1.7.5.4

I still suck at git send-email. The body of that should have read:
"In the mount utility use MAX_ADDR_LIST_LEN for bounds checking on ip addresses instead of MAX_ADDRESS_LEN. Parsed_mount_info->addrlist is MAX_ADDR_LIST_LEN chars long."

Quoted 7 lines

--
Peace and Blessings,
-Scott.
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 4 lines

Erm...except that ip= can only specify a single address. MAX_ADDRESS_LEN is the length of a single address whereas MAX_ADDR_LIST_LEN is 16 times that value. I'm not clear on what the perceived bug is here...

Hrm... I'm a bit confused as to why the parsed_mount_info has addrlist[MAX_ADDR_LIST_LEN] if it's only going to hold a single IP. Happy Thanksgiving, Jeff.

Signature · 2 lines
Peace and Blessings,
-Scott.

A message that is not in the archive (sent off-list or not yet received): CAFB9KM1uktUTtO5PuYkJjsavGdqpZrZ7YUd80_0Js=uOPUX1AA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#7 lore raw
Quoted 49 lines · On Thu, 22 Nov 2012 12:31:50 -0500 Scott Lovenberg…
Quoted 48 lines · Jeff Layton
Quoted 44 lines · Scott Lovenberg
Quoted 22 lines · On Wed, Nov 21, 2012 at 3:10 PM, <scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public…

From: Scott Lovenberg <[email protected]>

---
 mount.cifs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mount.cifs.c +1 -2
index a9632b4..f63c309 100644
@@ -941,8 +941,8 @@ parse_options(const char *data, struct
 parsed_mount_info *parsed_info)
                        if (!value || !*value) {
                                fprintf(stderr,
                                        "target ip address argument
 missing\n");
-                       } else if (strnlen(value, MAX_ADDRESS_LEN) <=
-                               MAX_ADDRESS_LEN) {
+                       } else if (strnlen(value, MAX_ADDR_LIST_LEN + 1)

<=

Quoted 7 lines
+                               MAX_ADDR_LIST_LEN) {
                                strcpy(parsed_info->addrlist, value);
                                if (parsed_info->verboseflag)
                                        fprintf(stderr,

--
1.7.5.4

I still suck at git send-email. The body of that should have read:
"In the mount utility use MAX_ADDR_LIST_LEN for bounds checking on ip addresses instead of MAX_ADDRESS_LEN. Parsed_mount_info->addrlist is MAX_ADDR_LIST_LEN chars long."

--
Peace and Blessings,
-Scott.
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 9 lines
Quoted 4 lines

Erm...except that ip= can only specify a single address. MAX_ADDRESS_LEN is the length of a single address whereas MAX_ADDR_LIST_LEN is 16 times that value. I'm not clear on what the perceived bug is here...

Hrm... I'm a bit confused as to why the parsed_mount_info has addrlist[MAX_ADDR_LIST_LEN] if it's only going to hold a single IP. Happy Thanksgiving, Jeff.

When you resolve a hostname, we get back a list of address records. Those are parsed and the addresses end up in the addrlist.

When you provide an 'ip=' address option manually however, you can only provide a single address. That still goes into the addrlist, but then you're just in the trivial case of trying an address list that contains a single address.

Signature · 1 line
Jeff Layton <[email protected]>

A message that is not in the archive (sent off-list or not yet received): 20121124092314.5b61490c-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org

#9 lore raw
Quoted 65 lines · Jeff Layton
Quoted 49 lines · On Thu, 22 Nov 2012 12:31:50 -0500 Scott Lovenberg…
Quoted 48 lines · Jeff Layton
Quoted 44 lines · Scott Lovenberg
Quoted 22 lines · On Wed, Nov 21, 2012 at 3:10 PM, <scott.lovenberg-Re5JQEeQqe8AvxtiuMwx3w@public…

From: Scott Lovenberg <[email protected]>

---
 mount.cifs.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mount.cifs.c +1 -2
index a9632b4..f63c309 100644
@@ -941,8 +941,8 @@ parse_options(const char *data, struct
 parsed_mount_info *parsed_info)
                        if (!value || !*value) {
                                fprintf(stderr,
                                        "target ip address argument
 missing\n");
-                       } else if (strnlen(value, MAX_ADDRESS_LEN) <=
-                               MAX_ADDRESS_LEN) {
+                       } else if (strnlen(value, MAX_ADDR_LIST_LEN + 1)

<=

Quoted 7 lines
+                               MAX_ADDR_LIST_LEN) {
                                strcpy(parsed_info->addrlist, value);
                                if (parsed_info->verboseflag)
                                        fprintf(stderr,

--
1.7.5.4

I still suck at git send-email. The body of that should have read:
"In the mount utility use MAX_ADDR_LIST_LEN for bounds checking on ip addresses instead of MAX_ADDRESS_LEN. Parsed_mount_info->addrlist is MAX_ADDR_LIST_LEN chars long."

--
Peace and Blessings,
-Scott.
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 9 lines
Quoted 4 lines

Erm...except that ip= can only specify a single address. MAX_ADDRESS_LEN is the length of a single address whereas MAX_ADDR_LIST_LEN is 16 times that value. I'm not clear on what the perceived bug is here...

Hrm... I'm a bit confused as to why the parsed_mount_info has addrlist[MAX_ADDR_LIST_LEN] if it's only going to hold a single IP. Happy Thanksgiving, Jeff.

When you resolve a hostname, we get back a list of address records. Those are parsed and the addresses end up in the addrlist.

Quoted 7 lines

When you provide an 'ip=' address option manually however, you can only provide a single address. That still goes into the addrlist, but then you're just in the trivial case of trying an address list that contains a single address.

--
Jeff Layton <[email protected]>

OK, that makes sense.

Signature · 2 lines
Peace and Blessings,
-Scott.