From 436661a406729f35db943b653d1279dbd263e468 Mon Sep 17 00:00:00 2001 From: Christoph Sarnowski Date: Sun, 18 Jan 2015 23:10:34 +0100 Subject: [PATCH] make regex work on null-containing strings by replacing null's with 0xff --- probe.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/probe.c b/probe.c index cf7711f..3a6306a 100644 --- a/probe.c +++ b/probe.c @@ -223,12 +223,22 @@ static int is_tls_protocol(const char *p, int len, struct proto *proto) static int regex_probe(const char *p, int len, struct proto *proto) { + char *str; regex_t **probe = proto->data; regmatch_t pos = { 0, len }; - - for (; *probe && regexec(*probe, p, 0, &pos, REG_STARTEND); probe++) + int i; + str = (char *)malloc(len+1); + str[len] = 0; + for(i=0;i