]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug 3324: loadFromFile: parse error while reading template file
authorAlex Rousskov <rousskov@measurement-factory.com>
Thu, 16 Feb 2012 04:23:15 +0000 (21:23 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Thu, 16 Feb 2012 04:23:15 +0000 (21:23 -0700)
Do not store and later use a pointer to a temporary String buffer.
HttpHeader::getByName() returns a temporary String.

src/ssl/ErrorDetailManager.cc

index 30a23e6eede724f27a9228cbca41ffe235d3c61f..40dd926fbd004b333e024394a4c03d520cfadb90 100644 (file)
@@ -209,14 +209,14 @@ Ssl::ErrorDetailFile::parse(const char *buffer, int len, bool eof)
                 return false;
             }
 
-            const char *errorName = parser.getByName("name").termedBuf();
-            if (!errorName) {
+            const String errorName = parser.getByName("name");
+            if (!errorName.size()) {
                 debugs(83, DBG_IMPORTANT, HERE <<
                        "WARNING! invalid or no error detail name on:" << s);
                 return false;
             }
 
-            Ssl::ssl_error_t ssl_error = Ssl::GetErrorCode(errorName);
+            Ssl::ssl_error_t ssl_error = Ssl::GetErrorCode(errorName.termedBuf());
             if (ssl_error == SSL_ERROR_NONE) {
                 debugs(83, DBG_IMPORTANT, HERE <<
                        "WARNING! invalid error detail name: " << errorName);