db-parser: fixed @STRING@ parser when ran at the end of the message

When @STRING@ was used right at the end of the message, it stepped outside
its input buffer and adding memory garbage to the parsed value.

This could only happen if:
  - the parsing parameter specifies characters in addition to isalnum()
  - the characters after the input buffer are either alphanumeric are
    within the characters specified as terminating characters or NUL

Reported-by: Evan Rempel <erempel@uvic.ca>
Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>