Software Development
Find the bug – The case of the degrading system
The following code contains a bug, can you spot it?
class Program
{
private Timer nextcheck;
public event EventHandler ServerSigFailed;
static void Main(string[] args)
{
var program = new Program();
if(program.ValidateServerSig() == false)
return;
program.DoOtherStuff();
}
public bool ValidateServerSig()
{
nextcheck = new Timer(state => ValidateServerSig());
var response = DoRequest("http://remote-srv/signature");
if(response.Failed)
{
var copy = ServerSigFailed;
if(copy!=null) copy(this, EventArgs.Empty);
return false;
}
var result = Utils.CheckPublic KeySignatureMatches(response);
if(result.Valid)
if(response.Failed)
{
var copy = ServerSigFailed;
if(copy!=null) copy(this, EventArgs.Empty);
return false;
}
// setup next check
nextcheck.Change(TimeSpan.FromSeconds(15), TimeSpan.FromSeconds(15));
return true;
}
}
What are the implications of this bug?
| Reference: | Find the bug – The case of the degrading system from our NCG partner Oren Eini at the Ayende @ Rahien blog. |
Do you want to know how to develop your skillset to become a sysadmin Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. Introduction to NGINX
2. Apache HTTP Server Cookbook
3. VirtualBox Essentials
4. Nagios Monitoring Cookbook
5. Linux BASH Programming Cookbook
6. Postgresql Database Tutorial
and many more ....
I agree to the Terms and Privacy Policy

