Changeset 0e48e54 for protocols/purple


Ignore:
Timestamp:
2016-05-26T00:29:14Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
d28fe1c4
Parents:
21f450c
Message:

purple: strdup the message instead of casting to char *

Fixes trac ticket 1255, which points out that a strip_html() call down
there may modify the passed string, and some purple plugins may pass
read-only string data to it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r21f450c r0e48e54  
    965965
    966966/* Generic handler for IM or chat messages, covers write_chat, write_im and write_conv */
    967 static void handle_conv_msg(PurpleConversation *conv, const char *who, const char *message, guint32 bee_flags, time_t mtime)
     967static void handle_conv_msg(PurpleConversation *conv, const char *who, const char *message_, guint32 bee_flags, time_t mtime)
    968968{
    969969        struct im_connection *ic = purple_ic_by_pa(conv->account);
    970970        struct groupchat *gc = conv->ui_data;
     971        char *message = g_strdup(message_);
    971972        PurpleBuddy *buddy;
    972973
     
    977978
    978979        if (conv->type == PURPLE_CONV_TYPE_IM) {
    979                 imcb_buddy_msg(ic, (char *) who, (char *) message, bee_flags, mtime);
     980                imcb_buddy_msg(ic, who, message, bee_flags, mtime);
    980981        } else if (gc) {
    981                 imcb_chat_msg(gc, who, (char *) message, bee_flags, mtime);
    982         }
     982                imcb_chat_msg(gc, who, message, bee_flags, mtime);
     983        }
     984
     985        g_free(message);
    983986}
    984987
Note: See TracChangeset for help on using the changeset viewer.