From f3e184c5402c184c94847ee79469cb0120bf84c4 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 6 Apr 2007 13:04:49 +0000 Subject: 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 --- src/configreader.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3