if StrBuf_ServGetln() is called in a loop, its return value has to be checked for...
[citadel.git] / webcit / wiki.c
index 2b0ba7f888eb905a6d5e19a63e8a7f928d86748b..627424fe5d9547be112043e51370b9f5ce1c078f 100644 (file)
@@ -169,7 +169,7 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP)
                wc_printf("<th>%s</th>", _("Date"));
                wc_printf("<th>%s</th>", _("Author"));
 
-               while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+               while((StrBuf_ServGetln(Buf) >= 0) &&  strcmp(ChrPtr(Buf), "000")) {
 
                        rev_date = extract_long(ChrPtr(Buf), 1);
                        webcit_fmt_date(rev_date_displayed, sizeof rev_date_displayed, rev_date, DATEFMT_FULL);
@@ -290,7 +290,7 @@ void tmplput_display_wiki_pagelist(StrBuf *Target, WCTemplputParams *TP)
 
                wc_printf("<th>%s</th>", _("Page title"));
 
-               while(StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+               while((StrBuf_ServGetln(Buf) >= 0) && strcmp(ChrPtr(Buf), "000")) {
                        StrBufExtract_token(pagetitle, Buf, 1, '|');
 
                        if (!bmstrcasestr((char *)ChrPtr(pagetitle), "_HISTORY_")) {    /* no history pages */