Tor Rustad wrote:
> Sheth Raxit wrote:
>
>> Is there any Opensource/Free tool to detect all possible Overflow
>> in the code. ?
>>
>> Situation :
>> recently i came across some old code, <written by some careless
>> programmer, not having 'useful' document>.
>>
>> What i am doing...<since last few days.>
>>
>> 1. analyzing code flow using cflow and cscope.
>> 2. Removing All possible warnings <by gcc's Wall option.>
>
> Can you add the -pedantic and -ansi switch too?
>
> Next step, is to look into adding more static analysis via lint
> tool, e.g. 'splint', but that require a lot of effort, if you have
> never used such a tool before.
>
>> 3.Found some crash on Dynamic memory stuff, <trying to Fix/Catch
>> more using Valgrind, <i am on linux> > , few crash fixed using gdb.
>
> Another, useful tool is Electric Fence, which often core dump at
> point of overflow.
>
> However, a while back, I read a report from a super-computing
> center, where they had analyzed different memory tools, of these
> Valgrind was the best free tool, but was well behind the best
> commercial tools.
>
>> Would be great if can provide any realistic/practical suggestion,
>> <Except review the whole code carefully, and manually detect.>
>
> If not already done, I would add a lot of assert()'s, and in
> particular watch out for off-by-one errors.
>
> Another tip is switching to: strlcpy() & strlcat().
Generally good advice. One slight addition I would recommend is
use of my nmalloc package, which includes comprehensive debugging
abilities. While written for DJGPP, it is quite general, and I
believe can operate on any byte addressed 32 bit system that has a
sbrk() call available and allows substitution of malloc packages.
It needs to be compiled with gcc. The package includes a manual.
When installed, just link it before the system library is searched.
The location also includes code for the (non-standard) strlcpy and
strlcat.
<http://cbfalconer.home.att.net/download/>
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
--
Posted via a free Usenet account from
http://www.teranews.com