* sanitize accesses, so valgrind doesn't moan of uninitialized values
authorWilfried Göesgens <willi@citadel.org>
Mon, 8 Sep 2008 18:00:42 +0000 (18:00 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 8 Sep 2008 18:00:42 +0000 (18:00 +0000)
webcit/fmt_date.c
webcit/messages.c

index 0492dbf550978604f20b6bcf498b4d48e67f98ad..ac4af4337bc64904a9882d54358f982959868464 100644 (file)
@@ -157,6 +157,8 @@ time_t httpdate_to_timestamp(char *buf)
        for (c = buf; *c != ' '; c++)
                ;
        c++;
+       
+       memset(&tt, 0, sizeof(tt));
 
        /* Get day of month */
        tt.tm_mday = atoi(c);
index 087ecea6581180fabb1c93a8e87f081471c23385..2200841f3953a01011ce4b6ff81560a834ee70c5 100644 (file)
@@ -1695,8 +1695,8 @@ void pullquote_message(long msgnum, int forward_attachments, int include_headers
                while (serv_getln(buf, sizeof buf), strcmp(buf, "000")) {
                        int len;
                        len = strlen(buf);
-                       if (buf[len-1] == '\n') buf[--len] = 0;
-                       if (buf[len-1] == '\r') buf[--len] = 0;
+                       if ((len > 0) && (buf[len-1] == '\n')) buf[--len] = 0;
+                       if ((len > 0) && (buf[len-1] == '\r')) buf[--len] = 0;
 
 #ifdef HAVE_ICONV
                        if (ic != (iconv_t)(-1) ) {