* don't double libcitadel header function for safestrncpy in webcit.h
authorWilfried Göesgens <willi@citadel.org>
Wed, 27 Feb 2008 23:10:42 +0000 (23:10 +0000)
committerWilfried Göesgens <willi@citadel.org>
Wed, 27 Feb 2008 23:10:42 +0000 (23:10 +0000)
* instead of dumb pointing to 255, search backwards from the copied amount of chars.

webcit/webcit.c
webcit/webcit.h

index 4c5fb894044910eea8acf3544399c4556499c0d8..b10fe397143cbb1c014e9479050cf7156d1fdc3d 100644 (file)
@@ -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)
index 890e432dde7c8c45b389f4d8025f1b4d1e3a3a23..d90c5181775aa6ac7413085e75a31d204af22524 100644 (file)
@@ -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);