comparison libpurple/plugins/perl/common/Status.xs @ 24688:08b65145276a

Fix off-by-ones in the perl loader where av_len is used. Fixes #7687. committer: John Bailey <rekkanoryo@rekkanoryo.org>
author Paul Aurich <paul@darkrain42.org>
date Thu, 11 Dec 2008 06:38:23 +0000
parents 907f5f41e32a
children 7fd6e5a72bf1 68a90c95b722
comparison
equal deleted inserted replaced
24687:d8452c0bec7b 24688:08b65145276a
81 PREINIT: 81 PREINIT:
82 GList *t_GL; 82 GList *t_GL;
83 int i, t_len; 83 int i, t_len;
84 PPCODE: 84 PPCODE:
85 t_GL = NULL; 85 t_GL = NULL;
86 t_len = av_len((AV *)SvRV(source_list)); 86 t_len = av_len((AV *)SvRV(source_list)) + 1;
87 87
88 for (i = 0; i < t_len; i++) { 88 for (i = 0; i < t_len; i++) {
89 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0))); 89 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(source_list), i, 0)));
90 } 90 }
91 purple_presence_add_list(presence, t_GL); 91 purple_presence_add_list(presence, t_GL);
377 PREINIT: 377 PREINIT:
378 GList *t_GL; 378 GList *t_GL;
379 int i, t_len; 379 int i, t_len;
380 CODE: 380 CODE:
381 t_GL = NULL; 381 t_GL = NULL;
382 t_len = av_len((AV *)SvRV(status_types)); 382 t_len = av_len((AV *)SvRV(status_types)) + 1;
383 383
384 for (i = 0; i < t_len; i++) { 384 for (i = 0; i < t_len; i++) {
385 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0))); 385 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(status_types), i, 0)));
386 } 386 }
387 RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id); 387 RETVAL = (PurpleStatusType *)purple_status_type_find_with_id(t_GL, id);