Mercurial > pidgin
comparison libpurple/plugins/perl/common/Conversation.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 |
---|---|
332 PREINIT: | 332 PREINIT: |
333 GList *l, *t_GL; | 333 GList *l, *t_GL; |
334 int i, t_len; | 334 int i, t_len; |
335 PPCODE: | 335 PPCODE: |
336 t_GL = NULL; | 336 t_GL = NULL; |
337 t_len = av_len((AV *)SvRV(users)); | 337 t_len = av_len((AV *)SvRV(users)) + 1; |
338 | 338 |
339 for (i = 0; i < t_len; i++) | 339 for (i = 0; i < t_len; i++) |
340 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); | 340 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); |
341 | 341 |
342 for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { | 342 for (l = purple_conv_chat_set_users(chat, t_GL); l != NULL; l = l->next) { |
370 PREINIT: | 370 PREINIT: |
371 GList *l, *t_GL; | 371 GList *l, *t_GL; |
372 int i, t_len; | 372 int i, t_len; |
373 PPCODE: | 373 PPCODE: |
374 t_GL = NULL; | 374 t_GL = NULL; |
375 t_len = av_len((AV *)SvRV(ignored)); | 375 t_len = av_len((AV *)SvRV(ignored)) + 1; |
376 | 376 |
377 for (i = 0; i < t_len; i++) | 377 for (i = 0; i < t_len; i++) |
378 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); | 378 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(ignored), i, 0))); |
379 | 379 |
380 for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { | 380 for (l = purple_conv_chat_set_ignored(chat, t_GL); l != NULL; l = l->next) { |
427 PREINIT: | 427 PREINIT: |
428 GList *t_GL_users, *t_GL_extra_msgs, *t_GL_flags; | 428 GList *t_GL_users, *t_GL_extra_msgs, *t_GL_flags; |
429 int i, t_len; | 429 int i, t_len; |
430 PPCODE: | 430 PPCODE: |
431 t_GL_users = NULL; | 431 t_GL_users = NULL; |
432 t_len = av_len((AV *)SvRV(users)); | 432 t_len = av_len((AV *)SvRV(users)) + 1; |
433 | 433 |
434 for (i = 0; i < t_len; i++) | 434 for (i = 0; i < t_len; i++) |
435 t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); | 435 t_GL_users = g_list_append(t_GL_users, SvPVutf8_nolen(*av_fetch((AV *)SvRV(users), i, 0))); |
436 | 436 |
437 t_GL_flags = NULL; | 437 t_GL_flags = NULL; |
438 t_len = av_len((AV *)SvRV(flags)); | 438 t_len = av_len((AV *)SvRV(flags)) + 1; |
439 | 439 |
440 for (i = 0; i < t_len; i++) | 440 for (i = 0; i < t_len; i++) |
441 t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); | 441 t_GL_flags = g_list_append(t_GL_flags, SvPVutf8_nolen(*av_fetch((AV *)SvRV(flags), i, 0))); |
442 | 442 |
443 t_GL_extra_msgs = NULL; | 443 t_GL_extra_msgs = NULL; |
444 t_len = av_len((AV *)SvRV(extra_msgs)); | 444 t_len = av_len((AV *)SvRV(extra_msgs)) + 1; |
445 | 445 |
446 for (i = 0; i < t_len; i++) | 446 for (i = 0; i < t_len; i++) |
447 t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); | 447 t_GL_extra_msgs = g_list_append(t_GL_extra_msgs, SvPVutf8_nolen(*av_fetch((AV *)SvRV(extra_msgs), i, 0))); |
448 | 448 |
449 purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); | 449 purple_conv_chat_add_users(chat, t_GL_users, t_GL_extra_msgs, t_GL_flags, new_arrivals); |