[Snort-devel] Invalid C code in log.c?

Erek Adams erek at ...105...
Sun Aug 19 00:58:15 EDT 2001


On Sat, 18 Aug 2001 snort-devel at ...616... wrote:

> In snort 1.8.1, log.c has:
>
>             case TCPOPT_MAXSEG:
>                 memset (tmp, 0, 5);
>                 fwrite("MSS: ", 5, 1, fp);
>                 strncpy((char*)tmp, (char*) (p->tcp_options[i].data), 2);
>                 fprintf(fp, "%u ", EXTRACT_16BITS(tmp));
>                 break;
>
> and decode.h has (WORDS_MUSTALIGN defined because this is Solaris
> 2.6/SPARC):
>   #define EXTRACT_32BITS(p)  ({ u_int32_t __tmp; memmove(&__tmp, (p),
> sizeof(u_int32_t)); (u_int32_t) ntohl(__tmp);})
>
> This doesn't build with Solaris C. Is this even valid? gcc -ansi
> -pedantic had this to say:
>
> log.c: In function `PrintTcpOptions':
> log.c:2159: warning: ANSI C forbids braced-groups within expressions

Erf....  It builds and runs just fine on 2.7 mu4.  gcc 2.95.

Might it be 2.6 based?

Anyone Else?

-----
Erek Adams
Nifty-Type-Guy
TheAdamsFamily.Net





More information about the Snort-devel mailing list