From c23bb7e270cd155347161b69f14523117a7fa464 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 26 Jan 2009 17:43:07 +0000 Subject: [PATCH] * fix memleak in preferences * fix buffer overruns in vcard presenting logic * zero WC->this_httphost at the end of a session, as it becomes invalid then. --- webcit/preferences.c | 1 + webcit/vcard_edit.c | 12 ++++++++---- webcit/webcit.c | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webcit/preferences.c b/webcit/preferences.c index 732ee1f59..a245928df 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -102,6 +102,7 @@ void GetPrefTypes(HashList *List) PrefType->OnLoad(Setting->Val, Setting->lval); } } + DeleteHashPos(&It); } void ParsePref(HashList **List, StrBuf *ReadBuf) diff --git a/webcit/vcard_edit.c b/webcit/vcard_edit.c index f56fd1c09..97ef83fa9 100644 --- a/webcit/vcard_edit.c +++ b/webcit/vcard_edit.c @@ -503,7 +503,8 @@ void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int ful long msgnum) { struct vCard *v; char *name; - char buf[SIZ]; + StrBuf *Buf; + StrBuf *Buf2; char this_alpha = 0; v = vcard_load((char*)vcard_source); ///TODO @@ -512,9 +513,12 @@ void display_vcard(StrBuf *Target, const char *vcard_source, char alpha, int ful name = vcard_get_prop(v, "n", 1, 0, 0); if (name != NULL) { - utf8ify_rfc822_string(name); - strcpy(buf, name); - this_alpha = buf[0]; + Buf = NewStrBufPlain(name, -1); + Buf2 = NewStrBufPlain(NULL, StrLength(Buf)); + StrBuf_RFC822_to_Utf8(Buf2, Buf, WC->DefaultCharset, NULL); + this_alpha = ChrPtr(Buf)[0]; + FreeStrBuf(&Buf); + FreeStrBuf(&Buf2); } if (storename != NULL) { diff --git a/webcit/webcit.c b/webcit/webcit.c index d63afdd64..eaf4d30b7 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1039,6 +1039,7 @@ SKIP_ALL_THIS_CRAP: WCC->upload_length = 0; } FreeStrBuf(&WCC->trailing_javascript); + WCC->http_host = NULL; } -- 2.30.2