From de1f2f6cd552da7ad5d5e9f077a0700dc65f7eff Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Fri, 9 Jan 2015 03:25:56 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/CPPXT-97 --- xmltooling/io/HTTPResponse.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/xmltooling/io/HTTPResponse.cpp b/xmltooling/io/HTTPResponse.cpp index 29623cc..94c1aef 100644 --- a/xmltooling/io/HTTPResponse.cpp +++ b/xmltooling/io/HTTPResponse.cpp @@ -95,14 +95,18 @@ void HTTPResponse::setCookie(const char* name, const char* value) void HTTPResponse::setResponseHeader(const char* name, const char* value) { - for (const char* ch=name; *ch; ++ch) { - if (iscntrl(*ch)) - throw IOException("Response header name contained a control character."); + if (name) { + for (const char* ch=name; *ch; ++ch) { + if (iscntrl(*ch)) + throw IOException("Response header name contained a control character."); + } } - for (const char* ch=value; *ch; ++ch) { - if (iscntrl(*ch)) - throw IOException("Value for response header ($1) contained a control character.", params(1,name)); + if (value) { + for (const char* ch=value; *ch; ++ch) { + if (iscntrl(*ch)) + throw IOException("Value for response header ($1) contained a control character.", params(1,name)); + } } } -- 2.1.4