* add additional bytes to the buffer, so swapping names doesn't buffer overrun. Fixes...
authorWilfried Göesgens <willi@citadel.org>
Mon, 27 Jul 2009 18:10:21 +0000 (18:10 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 27 Jul 2009 18:10:21 +0000 (18:10 +0000)
webcit/vcard_edit.c

index b690e01cc383928c9f14edfb9d74a6bf7192ac38..e05bb11c20c13669cebc61583f2a57a067b8c543 100644 (file)
@@ -253,7 +253,12 @@ void fetchname_parsed_vcard(struct vCard *v, char **storename) {
                                len);
                }
                else {
-                       *storename = strdup(name);
+                       size_t len;
+
+                       len = strlen (name);
+                       
+                       *storename = malloc(len + 3); /* \0 + eventualy missing ', '*/
+                       memcpy(*storename, name, len + 1);
                }
                /* vcard_n_prettyize(storename); */
        }