[Snort-devel] Suspect bug in mstring.c

Anders Larsen a.larsen at ...1053...
Wed Jan 30 05:00:20 EST 2002


On 2002-01-30 09:26 +0100 gangadhar npk wrote:
>     if the string is --> The*{}quick*{}fox*jumps*{}over*the*{}lazy*dog
>     the seperator is --> *{}
>      max_strs        --> 5
>     the o/p should be :-
>             The
>             quick
>             fox*jumps
>             over*the
>             lazy dog
>   But, the O/P is :
>             The
>             quick
>             fox
>             jumps
>             {}over*the*{}lazy*dog

The function mSplit is supposed to work similar to the standard function
strtok(), that is, the separator is a string of characters *any* of which
will cause a token break.
In your example, any one of the characters '*', '{' and '}' in the string
will terminate the token, so the observed output is correct.

Try:
    if the string is --> The*quick{fox}jumps*{}over*the*{}lazy*dog
    the separator is --> *{}
    max_strs         --> 5
    the output is:
            The
            quick
            fox
            jumps
            {}over*the*{}lazy*dog

which is exactly what is expected.

Cheers
  Anders




More information about the Snort-devel mailing list