From cb7a86df93f84622e8386686dc732b16f2c126bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Sun, 12 Jul 2009 11:04:22 +0000 Subject: [PATCH] * abort token extraction if increasebuf won't let us continue (constbufs for extracting integers...) --- libcitadel/lib/stringbuf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libcitadel/lib/stringbuf.c b/libcitadel/lib/stringbuf.c index 599b482c0..1cc92269a 100644 --- a/libcitadel/lib/stringbuf.c +++ b/libcitadel/lib/stringbuf.c @@ -1194,8 +1194,10 @@ int StrBufExtract_token(StrBuf *dest, const StrBuf *Source, int parmnum, char se } if (len >= dest->BufSize) { dest->BufUsed = len; - if (!IncreaseBuf(dest, 1, -1)) + if (IncreaseBuf(dest, 1, -1) < 0) { + dest->BufUsed --; break; + } } if ( (current_token == parmnum) && (*s != separator)) { @@ -1299,7 +1301,6 @@ unsigned long StrBufExtract_unsigned_long(const StrBuf* Source, int parmnum, cha } - /** * \brief a string tokenizer * \param dest Destination StringBuffer @@ -1347,8 +1348,10 @@ int StrBufExtract_NextToken(StrBuf *dest, const StrBuf *Source, const char **pSt } if (len >= dest->BufSize) { dest->BufUsed = len; - if (!IncreaseBuf(dest, 1, -1)) { + + if (IncreaseBuf(dest, 1, -1) < 0) { *pStart = EndBuffer + 1; + dest->BufUsed --; break; } } -- 2.39.2