summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall/config.c
diff options
context:
space:
mode:
authorkensmith <kensmith@FreeBSD.org>2007-10-30 05:03:37 +0000
committerkensmith <kensmith@FreeBSD.org>2007-10-30 05:03:37 +0000
commit9a82deac9e7798e8b266554e32ecacef71ffdee1 (patch)
tree7da16b4aad42f7dd98080266b753a41aee74e523 /usr.sbin/sysinstall/config.c
parent9a9592dceb6f0e4272fe29a22e426edd9092ae74 (diff)
downloadFreeBSD-src-9a82deac9e7798e8b266554e32ecacef71ffdee1.zip
FreeBSD-src-9a82deac9e7798e8b266554e32ecacef71ffdee1.tar.gz
Selecting amd and a few other things in the Networking config section
caused a segfault. It turns out that in pre-7.0 systems if you do getenv("amd_enable=YES") it will return the setting of the environment variable "amd_enable" but now it returns NULL. I think I found the places where sysinstall was potentially relying on that old behavior. Fix is to make a copy of the string to be used for the getenv(3) call, look for a '=' character in it, and replace it with '\0' if one is found. Stuck to sysinstall's typical coding standards despite urges to do otherwise. PR: 117642 MFC after: 2 days
Diffstat (limited to 'usr.sbin/sysinstall/config.c')
-rw-r--r--usr.sbin/sysinstall/config.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/sysinstall/config.c b/usr.sbin/sysinstall/config.c
index 4871089..baca42a 100644
--- a/usr.sbin/sysinstall/config.c
+++ b/usr.sbin/sysinstall/config.c
@@ -871,13 +871,18 @@ configNFSServer(dialogMenuItem *self)
int
configRpcBind(dialogMenuItem *self)
{
+ char *tmp, *tmp2;
int retval = 0;
int doupdate = 1;
if (self != NULL) {
retval = dmenuToggleVariable(self);
- if (strcmp(variable_get(self->data), "YES") != 0)
+ tmp = strdup(self->data);
+ if ((tmp2 = index(tmp, '=')) != NULL)
+ *tmp2 = '\0';
+ if (strcmp(variable_get(tmp), "YES") != 0)
doupdate = 0;
+ free(tmp);
}
if (doupdate && strcmp(variable_get(VAR_RPCBIND_ENABLE), "YES") != 0) {
OpenPOWER on IntegriCloud