From: Amos Jeffries Date: Mon, 28 Jan 2013 04:16:21 +0000 (-0700) Subject: Polish: complete Digest authentication constructors X-Git-Tag: SQUID_3_3_1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95238e5aa9730076c7ef7485bd28ba21b7057b79;p=thirdparty%2Fsquid.git Polish: complete Digest authentication constructors * update several Digest auth constructors to fully initialize their fields. * Also, fix one segmentation fault at level 9 debug in Digest auth. Detected by Coverity Scan. Issues 740536, 740537, 740366. --- diff --git a/src/auth/digest/User.cc b/src/auth/digest/User.cc index 03c2edf4ff..1cf7dd0ba5 100644 --- a/src/auth/digest/User.cc +++ b/src/auth/digest/User.cc @@ -9,7 +9,9 @@ Auth::Digest::User::User(Auth::Config *aConfig) : Auth::User(aConfig), HA1created(0) -{} +{ + memset(HA1, 0, sizeof(HA1)); +} Auth::Digest::User::~User() { diff --git a/src/auth/digest/UserRequest.cc b/src/auth/digest/UserRequest.cc index d53c340029..2d395d6905 100644 --- a/src/auth/digest/UserRequest.cc +++ b/src/auth/digest/UserRequest.cc @@ -20,7 +20,10 @@ Auth::Digest::UserRequest::UserRequest() : uri(NULL), response(NULL), nonce(NULL) -{} +{ + memset(nc, 0, sizeof(nc)); + memset(&flags, 0, sizeof(flags)); +} /** * Delete the digest request structure. diff --git a/src/auth/digest/auth_digest.cc b/src/auth/digest/auth_digest.cc index efda8a7f84..0c1a9fa6bb 100644 --- a/src/auth/digest/auth_digest.cc +++ b/src/auth/digest/auth_digest.cc @@ -764,7 +764,7 @@ authDigestLogUsername(char *username, Auth::UserRequest::Pointer auth_user_reque assert(auth_user_request != NULL); /* log the username */ - debugs(29, 9, "authDigestLogUsername: Creating new user for logging '" << username << "'"); + debugs(29, 9, "Creating new user for logging '" << (username?username:"[no username]") << "'"); Auth::User::Pointer digest_user = new Auth::Digest::User(static_cast(Auth::Config::Find("digest"))); /* save the credentials */ digest_user->username(username);