comparison libpurple/plugins/perl/common/Prefs.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 ae3263bfd3f5
children 7fd6e5a72bf1 68a90c95b722
comparison
equal deleted inserted replaced
24687:d8452c0bec7b 24688:08b65145276a
49 PREINIT: 49 PREINIT:
50 GList *t_GL; 50 GList *t_GL;
51 int i, t_len; 51 int i, t_len;
52 PPCODE: 52 PPCODE:
53 t_GL = NULL; 53 t_GL = NULL;
54 t_len = av_len((AV *)SvRV(value)); 54 t_len = av_len((AV *)SvRV(value)) + 1;
55 55
56 for (i = 0; i < t_len; i++) 56 for (i = 0; i < t_len; i++)
57 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); 57 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
58 58
59 purple_prefs_add_string_list(name, t_GL); 59 purple_prefs_add_string_list(name, t_GL);
71 PREINIT: 71 PREINIT:
72 GList *t_GL; 72 GList *t_GL;
73 int i, t_len; 73 int i, t_len;
74 PPCODE: 74 PPCODE:
75 t_GL = NULL; 75 t_GL = NULL;
76 t_len = av_len((AV *)SvRV(value)); 76 t_len = av_len((AV *)SvRV(value)) + 1;
77 77
78 for (i = 0; i < t_len; i++) 78 for (i = 0; i < t_len; i++)
79 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); 79 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
80 80
81 purple_prefs_add_path_list(name, t_GL); 81 purple_prefs_add_path_list(name, t_GL);
200 PREINIT: 200 PREINIT:
201 GList *t_GL; 201 GList *t_GL;
202 int i, t_len; 202 int i, t_len;
203 PPCODE: 203 PPCODE:
204 t_GL = NULL; 204 t_GL = NULL;
205 t_len = av_len((AV *)SvRV(value)); 205 t_len = av_len((AV *)SvRV(value)) + 1;
206 206
207 for (i = 0; i < t_len; i++) 207 for (i = 0; i < t_len; i++)
208 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); 208 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
209 209
210 purple_prefs_set_string_list(name, t_GL); 210 purple_prefs_set_string_list(name, t_GL);
222 PREINIT: 222 PREINIT:
223 GList *t_GL; 223 GList *t_GL;
224 int i, t_len; 224 int i, t_len;
225 PPCODE: 225 PPCODE:
226 t_GL = NULL; 226 t_GL = NULL;
227 t_len = av_len((AV *)SvRV(value)); 227 t_len = av_len((AV *)SvRV(value)) + 1;
228 228
229 for (i = 0; i < t_len; i++) 229 for (i = 0; i < t_len; i++)
230 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0))); 230 t_GL = g_list_append(t_GL, SvPVutf8_nolen(*av_fetch((AV *)SvRV(value), i, 0)));
231 231
232 purple_prefs_set_path_list(name, t_GL); 232 purple_prefs_set_path_list(name, t_GL);