summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-06 13:04:49 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-06 13:04:49 +0000
commitf3e184c5402c184c94847ee79469cb0120bf84c4 (patch)
tree36dc7a9cf5daf3a8f26eb83d13ec7f07f1c85054
parent821a5bca883ad8c06cb27963acf8861d9ef1031e (diff)
Fix issue spotted by devious - if a value is defined and a later rehash clears the value to empty, the value is not unset properly because it tries to memcpy zero bytes to the value -
this means memcpy just returns immediately. Now if the string value is 0 in length we copy one byte instead (which just copies the null terminator) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6743 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/configreader.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index a32249000..5e7ef67ca 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -723,7 +723,9 @@ void ServerConfig::Read(bool bail, userrec* user)
case DT_CHARPTR:
{
ValueContainerChar* vcc = (ValueContainerChar*)Values[Index].val;
- vcc->Set(vi.GetString(), strlen(vi.GetString()));
+ /* We do this so that an empty string can still be copied */
+ size_t length = strlen(vi.GetString());
+ vcc->Set(vi.GetString(), length ? length : 1);
}
break;
case DT_INTEGER: