* generaly NULL *Pos before re-caclulating it
authorWilfried Göesgens <willi@citadel.org>
Sun, 14 Feb 2010 21:09:27 +0000 (21:09 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 14 Feb 2010 21:09:27 +0000 (21:09 +0000)
* when re-allocating the read-buffer re-position pNL

libcitadel/lib/stringbuf.c

index afaa2e6e539edc0cc9cbb5abcd75b4ca76086ffb..a1955fad24d70903a9c20959d2b8af754d71515c 100644 (file)
@@ -3265,14 +3265,15 @@ int StrBufTCP_read_buffered_line_fast(StrBuf *Line,
                        {
                                long apos;
 
-                               apos = pLF - IOBuf->buf;
+                               if (pLF != NULL) apos = pLF - IOBuf->buf;
                                IncreaseBuf(IOBuf, 1, -1);      
-                               pLF = IOBuf->buf + apos;
+                               if (pLF != NULL) pLF = IOBuf->buf + apos;
                        }
 
                        continue;
                }
        }
+       *Pos = NULL;
        if (pLF != NULL) {
                pos = IOBuf->buf;
                rlen = 0;
@@ -3283,7 +3284,6 @@ int StrBufTCP_read_buffered_line_fast(StrBuf *Line,
                if (pLF + 1 >= IOBuf->buf + IOBuf->BufUsed)
                {
                        FlushStrBuf(IOBuf);
-                       *Pos = NULL;
                }
                else 
                        *Pos = pLF + 1;