pcap-log: fix pcre_study error check

Code was failing on a NULL return value which can be returned
when there was nothing todo instead of an error. Instead
check the errbuf for a non-NULL value to determine error.
pull/2490/merge
Jason Ish 9 years ago committed by Victor Julien
parent a2d31b5e04
commit 19e578a740

@ -962,7 +962,7 @@ static OutputCtx *PcapLogInitCtx(ConfNode *conf)
timestamp_pattern, pcre_erroffset, pcre_errbuf); timestamp_pattern, pcre_erroffset, pcre_errbuf);
} }
pcre_timestamp_extra = pcre_study(pcre_timestamp_code, 0, &pcre_errbuf); pcre_timestamp_extra = pcre_study(pcre_timestamp_code, 0, &pcre_errbuf);
if (pcre_timestamp_extra == NULL) { if (pcre_errbuf != NULL) {
FatalError(SC_ERR_PCRE_STUDY, "Fail to study pcre: %s", pcre_errbuf); FatalError(SC_ERR_PCRE_STUDY, "Fail to study pcre: %s", pcre_errbuf);
} }

Loading…
Cancel
Save