]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix issue spotted by devious - if a value is defined and a later rehash clears the...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 6 Apr 2007 13:04:49 +0000 (13:04 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Fri, 6 Apr 2007 13:04:49 +0000 (13:04 +0000)
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

index a322490009832e611644fcc912b17e4b1bcbfc1a..5e7ef67ca23e461721dfd83936d83bb66bf7c66b 100644 (file)
@@ -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: