[xmlsec] Re: Problem: Comparing decimal with hexadecimal numbers

Rich Salz rsalz at datapower.com
Mon Sep 15 17:06:36 PDT 2003


>     if( bufsize == sizeof(int) )
>         i = *(int*)buf;

Since buf is a byte pointer, you're asking for portability
problems (SIGBUS, anyone?) if it's not aligned.

        if (bufsize == sizeof (int))
                memcpy(&i, buf, sizeof (int))

Portable and safe.
        /r$

--
Rich Salz                  Chief Security Architect
DataPower Technology       http://www.datapower.com
XS40 XML Security Gateway  http://www.datapower.com/products/xs40.html
XML Security Overview      http://www.datapower.com/xmldev/xmlsecurity.html




More information about the xmlsec mailing list