From: Wilfried Göesgens Date: Sun, 12 Jul 2009 11:04:22 +0000 (+0000) Subject: * abort token extraction if increasebuf won't let us continue (constbufs for extracti... X-Git-Tag: v7.86~988 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=cb7a86df93f84622e8386686dc732b16f2c126bc * abort token extraction if increasebuf won't let us continue (constbufs for extracting integers...) --- 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; } }