--- snort-2.3.3.orig/src/log.c 2005-09-17 00:34:21.000000000 -0300 +++ snort-2.3.3/src/log.c 2005-09-17 00:47:50.000000000 -0300 @@ -1478,7 +1478,10 @@ { for(j = 0; j < p->ip_options[i].len; j++) { - fprintf(fp, "%02X", p->ip_options[i].data[j]); + if (p->ip_options[i].data) + fprintf(fp, "%02X", p->ip_options[i].data[j]); + else + fprintf(fp, "%02X", 0); if((j % 2) == 0) fprintf(fp, " "); @@ -1522,7 +1525,8 @@ case TCPOPT_MAXSEG: bzero((char *) tmp, 5); fwrite("MSS: ", 5, 1, fp); - memcpy(tmp, p->tcp_options[i].data, 2); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 2); fprintf(fp, "%u ", EXTRACT_16BITS(tmp)); break; @@ -1535,15 +1539,20 @@ break; case TCPOPT_WSCALE: - fprintf(fp, "WS: %u ", p->tcp_options[i].data[0]); + if (p->tcp_options[i].data) + fprintf(fp, "WS: %u ", p->tcp_options[i].data[0]); + else + fprintf(fp, "WS: %u ", 0); break; case TCPOPT_SACK: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 2); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 2); fprintf(fp, "Sack: %u@", EXTRACT_16BITS(tmp)); bzero((char *) tmp, 5); - memcpy(tmp, (p->tcp_options[i].data) + 2, 2); + if (p->tcp_options[i].data) + memcpy(tmp, (p->tcp_options[i].data) + 2, 2); fprintf(fp, "%u ", EXTRACT_16BITS(tmp)); break; @@ -1553,40 +1562,47 @@ case TCPOPT_ECHO: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "Echo: %u ", EXTRACT_32BITS(tmp)); break; case TCPOPT_ECHOREPLY: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "Echo Rep: %u ", EXTRACT_32BITS(tmp)); break; case TCPOPT_TIMESTAMP: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "TS: %u ", EXTRACT_32BITS(tmp)); bzero((char *) tmp, 5); - memcpy(tmp, (p->tcp_options[i].data) + 4, 4); + if (p->tcp_options[i].data) + memcpy(tmp, (p->tcp_options[i].data) + 4, 4); fprintf(fp, "%u ", EXTRACT_32BITS(tmp)); break; case TCPOPT_CC: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "CC %u ", EXTRACT_32BITS(tmp)); break; case TCPOPT_CCNEW: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "CCNEW: %u ", EXTRACT_32BITS(tmp)); break; case TCPOPT_CCECHO: bzero((char *) tmp, 5); - memcpy(tmp, p->tcp_options[i].data, 4); + if (p->tcp_options[i].data) + memcpy(tmp, p->tcp_options[i].data, 4); fprintf(fp, "CCECHO: %u ", EXTRACT_32BITS(tmp)); break; @@ -1598,7 +1614,10 @@ for(j = 0; j < p->tcp_options[i].len; j++) { - fprintf(fp, "%02X", p->tcp_options[i].data[j]); + if (p->tcp_options[i].data) + fprintf(fp, "%02X", p->tcp_options[i].data[j]); + else + fprintf(fp, "%02X", 0); if((j % 2) == 0) fprintf(fp, " ");