]> git.ipfire.org Git - thirdparty/squid.git/commit
Fix coredump bug when auth header contains invalid characters
authorwessels <>
Mon, 23 Apr 2007 11:50:37 +0000 (11:50 +0000)
committerwessels <>
Mon, 23 Apr 2007 11:50:37 +0000 (11:50 +0000)
commit35b3bc895f462f63b7165cf362a923c3ddaa2cd8
treee066a0d162098f1758956bc3078df33ba308db6e
parent147c7544267d3aceb2518844f58f581749086467
Fix coredump bug when auth header contains invalid characters

Apologies for the previous empty commit message.  Here is what
should have been there.

When a Proxy-Authorization header contains invalid characters (ie
NL or CR), BasicUser::extractUsername will emit an error message
and the username will not be set.  However, extractPassword was
also being called and it does not check for funny characters in the
cleartext string.  Thus passwd was being set.  BasicUser::valid was
returning true because it only looked at the passwd.

This bugfix has three components:

1) BasicUser::valid now checks the username, as well as the password.

2) Moved the check for invalid characters to BasicUser::decodeCleartext,
   which now returns boolean.  We will not call extractUsername and
   extractPassword if decodeCleartext fails.

3) extractUsername was freeing the cleartext string, but not setting
   the pointer to NULL, thus causing a double-free in the BasicUser
   destructor.

NOTE that the previous commit left the invalid character check in
extractUsername, but I realized it fits better in decodeCleartext
while writing the commit message, which led to the empty log.
src/auth/basic/auth_basic.cc
src/auth/basic/auth_basic.h