Re: init_agent() crashing

Bart Van Assche <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <CAO+b5-qnuRfzQLqUK1B4mP3Bso87GsL08rxjjfpL0AviDQL13g@mail.gmail.com>
On Tue, Feb 14, 2012 at 10:08 AM, rosy <[email protected]> wrote:

> Thanks for your reply. It did work. But i would like to appreciate if
> you would let me know why it works..
>  0xff in binary is 11111111.. and by doing  tolower((*cp) & 0xff)..it
> will set the corresponding bits which are 1 in (*cp)..
>  But how it solved the crashing issue ??
>

Most likely because the value of *cp was in the range 0x80..0xfe, because
your compiler uses signed chars and because it (incorrectly) sign-extended
the value of *cp by adding 0xffffff00. If your C library implements
tolower() via array lookup then sign-extending *cp can cause a crash.

Now again it crashing at  while (*from != 0 && !isspace(*from)) ...
> I did !isspace(*from & 0xff) ..but it's not working.. :(
> Why its crashing when Its calling all the c -related functions.. Is
> there any problem with my cross compiler..??
> Would appreciate if you can guide me on this..
>

You can try to have a look at the generated assembler code, try to find out
what your compiler is doing wrong and try to find a workaround.

Bart.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.