From: Wilfried Göesgens Date: Wed, 27 Feb 2008 23:10:42 +0000 (+0000) Subject: * don't double libcitadel header function for safestrncpy in webcit.h X-Git-Tag: v7.86~2456 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=cc9e3fab1e1bbc10315446c6cc21d16e0b29e18c;p=citadel.git * don't double libcitadel header function for safestrncpy in webcit.h * instead of dumb pointing to 255, search backwards from the copied amount of chars. --- diff --git a/webcit/webcit.c b/webcit/webcit.c index 4c5fb8940..b10fe3971 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -67,16 +67,18 @@ void addurls(char *url) { char *up, *ptr; char buf[SIZ]; - int a, b, len; + int a, b, len, n; struct urlcontent *u; up = url; while (!IsEmptyStr(up)) { /** locate the = sign */ - safestrncpy(buf, up, sizeof buf); + n = safestrncpy(buf, up, sizeof buf); + if (n < 0) /** hm, we exceeded the buffer... hmmm what todo now? */ + n = -n; b = (-1); - for (a = 255; a >= 0; --a) + for (a = n; a >= 0; --a) if (buf[a] == '=') b = a; if (b < 0) diff --git a/webcit/webcit.h b/webcit/webcit.h index 890e432dd..d90c51817 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -638,7 +638,6 @@ void get_preference(char *key, char *value, size_t value_len); void set_preference(char *key, char *value, int save_to_server); void knrooms(void); int is_msg_in_mset(char *mset, long msgnum); -char *safestrncpy(char *dest, const char *src, size_t n); void display_addressbook(long msgnum, char alpha); void offer_start_page(void); void convenience_page(char *titlebarcolor, char *titlebarmsg, char *messagetext);