[elinks-dev] [bug] crash when adding bookmark folder

Stephane CHAZELAS Stephane.CHAZELAS at free.fr
Wed Oct 8 05:56:25 PDT 2003


SEGV in memmove(0x815ad40, 0x815ad40, 1)  called from:
#0  trim_chars (s=0x815ad40 "", c=32 ' ', len=0x0) at ../../src/util/conv.h:145
#1  0x080bb690 in sanitize_url (url=0x815ad40 "") at bookmarks.c:90
#2  0x080bae2e in add_bookmark (root=0x0, place=1, title=0x829c398 "qsd", url=0x815ad40 "") at bookmarks.c:103
#3  0x080bb8ff in do_add_folder (dlg=0x829bca0, name=0x829c398 "qsd") at dialogs.c:151

because in do_add_folder, there's
bm = add_bookmark(bm, 1, name, "");

and "" is a readonly address, and my memmove doesn't seem
optimized enough to see that the "from" and "to" addresses are
the same.

A work around could be:

<<
--- /home/chazelas/tmp/conv.h~  Wed Oct  8 14:35:46 2003
+++ src/util/conv.h     Wed Oct  8 14:35:46 2003
@@ -142,7 +142,8 @@
        while (*p == c) p++, l--;
        while (l && p[l - 1] == c) p[--l] = '\0';

-       memmove(s, p, l + 1);
+       if (s != p)
+         memmove(s, p, l + 1);
        if (len) *len = l;

        return s;
>>

tested with this morning CVS tree.

-- 
Stéphane



More information about the elinks-dev mailing list