pidgin: efd2cab1: Fix a couple of crashes in the perl plug...

sadrul at pidgin.im sadrul at pidgin.im
Sat May 16 14:35:34 EDT 2009


-----------------------------------------------------------------
Revision: efd2cab15f62069c9bcf7c599b2818fc7ac7703a
Ancestor: 2f3657123ac0390c8a5d94dcb1920e22fd59af29
Author: sadrul at pidgin.im
Date: 2009-05-16T18:33:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/efd2cab15f62069c9bcf7c599b2818fc7ac7703a

Modified files:
        libpurple/plugins/perl/perl-handlers.c

ChangeLog: 

Fix a couple of crashes in the perl plugin loader.

* Do NULL check before using strcmp. The NULL could be set by either
  libpurple, or the plugin.
* Looks like we need to PERL_SET_CONTEXT to setup the perl environment
  correctly.

-------------- next part --------------
============================================================
--- libpurple/plugins/perl/perl-handlers.c	82a02f5307b626e623a5aa24d58521ee14efca47
+++ libpurple/plugins/perl/perl-handlers.c	9ce4aa0be282b7b90a41358a796c051e76de0ee7
@@ -284,6 +284,8 @@ perl_signal_cb(va_list args, void *data)
 	DATATYPE **copy_args;
 
 	dSP;
+	PERL_SET_CONTEXT(my_perl);
+	SPAGAIN;
 	ENTER;
 	SAVETMPS;
 	PUSHMARK(sp);
@@ -364,7 +366,8 @@ perl_signal_cb(va_list args, void *data)
 					break;
 
 				case PURPLE_TYPE_STRING:
-					if (strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) {
+					if (!*((char **)copy_args[i]) || !SvPVX(sv_args[i]) ||
+							strcmp(*((char **)copy_args[i]), SvPVX(sv_args[i]))) {
 						g_free(*((char **)copy_args[i]));
 						*((char **)copy_args[i]) =
 							g_strdup(SvPVutf8_nolen(sv_args[i]));


More information about the Commits mailing list