Home page logo
/

nmap-dev logo Nmap Development mailing list archives

Re: Unreachable success in EchoServer.cc
From: David Fifield <david () bamsoftware com>
Date: Mon, 11 Jun 2012 19:18:11 -0700

On Fri, Jun 08, 2012 at 08:31:01PM -0600, sean rivera wrote:
Hey all,

I was looking at the warnings in EchoServer.cc and I noticed that in
EchoServer::start() there is an unreachable line code. More specifically
the return OP_SUCCESS; will never be called, near as I can tell.

From what I can see there is a while(1) loop above that can only be broken
out of in 3 places.
Line 1454 if the calloc fails.
Line 1459 if the new client creation fails.
Line 1479 if the generate hs_server doesn't return OP_SUCCES

All three of those places return OP_FAILURE, and there is no where that one
can break out of the infinite loop to get OP_SUCCESS.

Is that OP_SUCCESS just there to quite compiler warnings about not having a
return value, or am I just missing something?

I don't think this is anything to be worried about. It's just defensive
programming, returning a value in case the loop is ever modified to
break.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]