Richard Laager rlaager at
Sun Sep 16 14:46:24 EDT 2007

On Sun, 2007-09-16 at 11:27 -0700, Sean Egan wrote:
> Does anyone have an answer to ?

I left a couple of comments there.

While looking, I found this:

         * Plugin stuff. we pass a char ** but we don't want to pass what's
         * been given us by the prpls. So we create temp holders and pass
         * those instead. It's basically just to avoid segfaults.
        /* TODO: MAX(message, BUF_LONG) is pretty ugly. */
        buffy = g_malloc(MAX(strlen(msg) + 1, BUF_LONG));
        strcpy(buffy, msg);
        angel = g_strdup(who);

        plugin_return = GPOINTER_TO_INT(
                                                                  "receiving-im-msg", gc->account,
                                                                  &angel, &buffy, cnv, &flags));

Why are we passing a minimum of a BUF_LONG buffer? If anything, why not
just do buffy = g_strdup(msg)? I don't think we should be attempting to
prevent segfaults by passing a big buffer to plugins so they can stomp
around as they please. If the plugin wants to return a longer string,
then they can g_strdup() it themselves, free the old one, and set the
pointer to their new memory. That's how I've seen everything do it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the Devel mailing list