From: Wilfried Göesgens Date: Mon, 8 Sep 2008 18:00:42 +0000 (+0000) Subject: * sanitize accesses, so valgrind doesn't moan of uninitialized values X-Git-Tag: v7.86~1958 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=2c97ce2f2e8dda0efc924dc47c74c9444e017002 * sanitize accesses, so valgrind doesn't moan of uninitialized values --- diff --git a/webcit/fmt_date.c b/webcit/fmt_date.c index 0492dbf55..ac4af4337 100644 --- a/webcit/fmt_date.c +++ b/webcit/fmt_date.c @@ -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); diff --git a/webcit/messages.c b/webcit/messages.c index 087ecea65..2200841f3 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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) ) {