From 33eb3d4ab6fdad17eaa4773aad9d1fd5a0e158c1 Mon Sep 17 00:00:00 2001 From: Andreas Steffen Date: Fri, 25 Apr 2008 07:04:59 +0000 Subject: [PATCH] extract_token() now handles whitespace --- src/libstrongswan/utils/lexparser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libstrongswan/utils/lexparser.c b/src/libstrongswan/utils/lexparser.c index c235769719..9019c26025 100644 --- a/src/libstrongswan/utils/lexparser.c +++ b/src/libstrongswan/utils/lexparser.c @@ -48,6 +48,14 @@ bool extract_token(chunk_t *token, const char termination, chunk_t *src) { u_char *eot = memchr(src->ptr, termination, src->len); + if (termination == ' ') + { + u_char *eot_tab = memchr(src->ptr, '\t', src->len); + + /* check if a tab instead of a space terminates the token */ + eot = ( eot_tab == NULL || (eot && eot < eot_tab) ) ? eot : eot_tab; + } + /* initialize empty token */ *token = chunk_empty;