Skip to contentSkip to conversation

SEGV when auto.master in yp-server is with a blank line at last

PATCH wengang wang 2 participants 2 messages Feb 28, 2008 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi experts,

Recently I met a problem on RHEL5.1 with autofs-5.0.1-0.rc2.55

automount SEGV core dumps when running with configs:

/etc/auto.master
===
+auto.master
===

/etc/nsswitch.conf
===
automount: files nis
===

ypcat -k auto.master | cat -A
===
/nfs/opsutils auto.opsutils^I^I-rw,soft$
/nfs/private auto.private^I-rw,intr,nosuid$
/nfs/roview auto.roview -rw,intr,nosuid$
/nfs/group auto.group^I^I-rw,intr$
/nfs/floor auto.floor^I^I-ro,soft$
/nfs/net -hosts^I^I^I-ro,soft,nosuid$
/nfs/log auto.log-hq^I-rw,intr$
/netvobs auto.vobs^I-rw,hard,intr,nosuid$
/netview auto.view^I-rw,hard,intr,nosuid$
/home auto.home^I^I-rw,intr,nosuid$
/SCM auto.scm^I-rw,hard,intr,nosuid$
$

I found the core dump is caused by the last blank line in auto.master. and I wrote a patch on it.

modules/lookup_yp.c 2008-02-27 22:51:40.000000000 -0500 renamed from modules/lookup_yp.c.bug 2008-02-27 22:50:26.000000000 -0500 +3 -0
@@ -175,6 +175,9 @@
        if (*ypkey == '+')
                return 0;
 
+       if (ypkeylen == 0)
+               return 0;
+
        *(ypkey + ypkeylen) = '\0';
        *(val + vallen) = '\0';
 

and seems this patch fixes the problem.

Is there anything wrong with the patch?

thanks,
wengang.

maintainer
#1 lore raw
Quoted 49 lines · wengang wang

Hi experts,

Recently I met a problem on RHEL5.1 with autofs-5.0.1-0.rc2.55

automount SEGV core dumps when running with configs:

/etc/auto.master
===
+auto.master
===

/etc/nsswitch.conf
===
automount: files nis
===

ypcat -k auto.master | cat -A
===
/nfs/opsutils auto.opsutils^I^I-rw,soft$
/nfs/private auto.private^I-rw,intr,nosuid$
/nfs/roview auto.roview -rw,intr,nosuid$
/nfs/group auto.group^I^I-rw,intr$
/nfs/floor auto.floor^I^I-ro,soft$
/nfs/net -hosts^I^I^I-ro,soft,nosuid$
/nfs/log auto.log-hq^I-rw,intr$
/netvobs auto.vobs^I-rw,hard,intr,nosuid$
/netview auto.view^I-rw,hard,intr,nosuid$
/home auto.home^I^I-rw,intr,nosuid$
/SCM auto.scm^I-rw,hard,intr,nosuid$
$

I found the core dump is caused by the last blank line in auto.master. and I wrote a patch on it.

modules/lookup_yp.c 2008-02-27 22:51:40.000000000 -0500 renamed from modules/lookup_yp.c.bug 2008-02-27 22:50:26.000000000 -0500 +3 -0
@@ -175,6 +175,9 @@
        if (*ypkey == '+')
                return 0;
 
+       if (ypkeylen == 0)
+               return 0;
+
        *(ypkey + ypkeylen) = '\0';
        *(val + vallen) = '\0';
 

and seems this patch fixes the problem.

Quoted 1 line

Is there anything wrong with the patch?

Ha, you may have spotted a NIS module bug that I couldn't find ages ago. Well done.

Looks like this is the right thing to do in this case, yes, I think it's fine.

Thanks.
Ian