Skip to contentSkip to conversation

Catch malformed entries in parse_sun

PATCH New Jeff Moyer 1 participant 1 message Apr 29, 2005 Kernel automounter

lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 Catch malformed entries in parse_sun

Hi Ian,

Here is another trivial patch. The connectathon test sweet does some negative testing. Here is a malformed entry that we will attempt to mount:

b1c /server.example.com

It turns out that we think this is a multimount entry, and the what string is actually NULL! The attached patch catches this before handing off to the mount module. This was the least intrusive fix I could think of, but this could warrant further debate as to where in the parse code this should be handled.

-Jeff

modules/parse_sun.c renamed from modules/parse_sun.c.orig +4 -0
@@ -678,6 +678,10 @@ static int sun_mount(const char *root, c
 	    "mounting root %s, mountpoint %s, what %s, fstype %s, options %s\n",
 	    root, mountpoint, what, fstype, options);
 
+	/* A malformed entry of the form key /xyz will trigger this case */
+	if (!what || *what == '\0')
+		return 1;
+
 	if (!strcmp(fstype, "nfs")) {
 		rv = mount_nfs->mount_mount(root, mountpoint, strlen(mountpoint),
 					    what, fstype, options, mount_nfs->context);