diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-05-13 11:41:52 +0200 |
---|---|---|
committer | Daniel Borkmann <dborkman@redhat.com> | 2013-05-13 11:43:42 +0200 |
commit | bf43e1993c7037ea9f23bf0cac4ec7de0e3b1ca8 (patch) | |
tree | 1af1078702f5b499c49d2b818217a15e33e06bba | |
parent | a3a0afe1189c69a05c3b8329b35bdaa5de72b038 (diff) |
trafgen: lexer: return original string if no shellcode
When do not detect any shellcode, make sure we return the original
string only.
Reported-by: Jon Schipp <jonschipp@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
-rw-r--r-- | trafgen_lexer.l | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/trafgen_lexer.l b/trafgen_lexer.l index ca5bff9..146d0e7 100644 --- a/trafgen_lexer.l +++ b/trafgen_lexer.l @@ -26,7 +26,7 @@ static char *try_convert_shellcode(char *sstr) { int j = 0; bool found_any = false; - char *bstr, *ostr = sstr, *hay; + char *bstr, *ostr = sstr, *hay, *orig = sstr; size_t blen, slen = strlen(sstr), tot = 0; const char *needle = "\\x"; @@ -34,7 +34,7 @@ static char *try_convert_shellcode(char *sstr) slen -= 2; if (slen % 4 != 0) - return sstr; + return orig; blen = slen / 4; hay = sstr; @@ -45,7 +45,7 @@ static char *try_convert_shellcode(char *sstr) } if (blen != tot || !found_any) - return sstr; + return orig; blen += 2; bstr = xzmalloc(blen); |