diff options
author | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-05 02:49:40 +0000 |
---|---|---|
committer | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-05 02:49:40 +0000 |
commit | 790fc4f0bdc951e81870c9e6ec3d5b94c1d01b6c (patch) | |
tree | 94ff93f75aadc71e238e40bc4d1f0c2e0f05cf6b /src | |
parent | c5259e656e1535e6b8e5bcada85901e67bdceefb (diff) |
Correct use of ValueContainerChar to work properly instead of crashing at run-time.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1422 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/config.c b/src/config.c index 34f66e211..8341314c0 100644 --- a/src/config.c +++ b/src/config.c @@ -513,7 +513,7 @@ int ServerConfig::Read(bool bail) * * If you want to create a directive using a character pointer without additional validation (see below for hostnames, fields with no spaces, and IP addresses): * char *blarg; - * {"tag", "value", "", new ValueContainerChar(blarg), DT_CHARPTR, <validation>}, + * {"tag", "value", "", new ValueContainerChar(&blarg), DT_CHARPTR, <validation>}, * * If you want to create a directive using a string: * std::string blarg; @@ -546,12 +546,12 @@ int ServerConfig::Read(bool bail) * * We may need to add some other validation functions to handle certain things, we can handle that later. * Any questions about these, w00t, feel free to ask. */ - {"uplink", "type", "", new ValueContainerChar(IRCDModule), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, - {"uplink", "host", "", new ValueContainerChar(RemoteServer), DT_HOSTNAME | DT_NORELOAD, ValidateNotEmpty}, + {"uplink", "type", "", new ValueContainerChar(&IRCDModule), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, + {"uplink", "host", "", new ValueContainerChar(&RemoteServer), DT_HOSTNAME | DT_NORELOAD, ValidateNotEmpty}, {"uplink", "port", "0", new ValueContainerInt(&RemotePort), DT_INTEGER | DT_NORELOAD, ValidatePort}, - {"uplink", "password", "", new ValueContainerChar(RemotePassword), DT_NOSPACES | DT_NORELOAD, ValidateNotEmpty}, - {"nickserv", "nick", "NickServ", new ValueContainerChar(s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, - {"nickserv", "descrption", "Nickname Registration Service", new ValueContainerChar(desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, + {"uplink", "password", "", new ValueContainerChar(&RemotePassword), DT_NOSPACES | DT_NORELOAD, ValidateNotEmpty}, + {"nickserv", "nick", "NickServ", new ValueContainerChar(&s_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, + {"nickserv", "descrption", "Nickname Registration Service", new ValueContainerChar(&desc_NickServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -595,25 +595,29 @@ int ServerConfig::Read(bool bail) case DT_NOSPACES: { ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val); ValidateNoSpaces(vi.GetString(), Values[Index].tag, Values[Index].value); - vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1); + char *tmp = vi.GetString(); + vcc->Set(&tmp, strlen(vi.GetString()) + 1); } break; case DT_HOSTNAME: { ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val); ValidateHostname(vi.GetString(), Values[Index].tag, Values[Index].value); - vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1); + char *tmp = vi.GetString(); + vcc->Set(&tmp, strlen(vi.GetString()) + 1); } break; case DT_IPADDRESS: { ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val); ValidateIP(vi.GetString(), Values[Index].tag, Values[Index].value, allow_wild); - vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1); + char *tmp = vi.GetString(); + vcc->Set(&tmp, strlen(vi.GetString()) + 1); } break; case DT_CHARPTR: { ValueContainerChar *vcc = dynamic_cast<ValueContainerChar *>(Values[Index].val); // Make sure we also copy the null terminator - vcc->Set(vi.GetString(), strlen(vi.GetString()) + 1); + char *tmp = vi.GetString(); + vcc->Set(&tmp, strlen(vi.GetString()) + 1); } break; case DT_STRING: { |