Mercurial > pidgin.yaz
comparison src/protocols/oscar/tlv.c @ 3459:d82f53194f09
[gaim-migrate @ 3507]
DANCE!
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 28 Aug 2002 07:24:12 +0000 |
parents | 6d62d4520460 |
children | e73c48cf1645 |
comparison
equal
deleted
inserted
replaced
3458:66b1ad9782a9 | 3459:d82f53194f09 |
---|---|
44 * | 44 * |
45 */ | 45 */ |
46 faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs) | 46 faim_internal aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs) |
47 { | 47 { |
48 aim_tlvlist_t *list = NULL, *cur; | 48 aim_tlvlist_t *list = NULL, *cur; |
49 fu16_t type, length; | 49 |
50 | 50 while (aim_bstream_empty(bs) > 0) { |
51 while (aim_bstream_empty(bs)) { | 51 fu16_t type, length; |
52 | 52 |
53 type = aimbs_get16(bs); | 53 type = aimbs_get16(bs); |
54 length = aimbs_get16(bs); | 54 length = aimbs_get16(bs); |
55 | 55 |
56 #if 0 /* temporarily disabled until I know if they're still doing it or not */ | 56 #if 0 /* temporarily disabled until I know if they're still doing it or not */ |
68 if (0) | 68 if (0) |
69 ; | 69 ; |
70 #endif | 70 #endif |
71 else { | 71 else { |
72 | 72 |
73 if (length > aim_bstream_empty(bs)) { | |
74 aim_freetlvchain(&list); | |
75 return NULL; | |
76 } | |
77 | |
73 cur = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)); | 78 cur = (aim_tlvlist_t *)malloc(sizeof(aim_tlvlist_t)); |
79 if (!cur) { | |
80 aim_freetlvchain(&list); | |
81 return NULL; | |
82 } | |
83 | |
74 memset(cur, 0, sizeof(aim_tlvlist_t)); | 84 memset(cur, 0, sizeof(aim_tlvlist_t)); |
75 | 85 |
76 cur->tlv = createtlv(); | 86 cur->tlv = createtlv(); |
87 if (!cur->tlv) { | |
88 free(cur); | |
89 aim_freetlvchain(&list); | |
90 return NULL; | |
91 } | |
77 cur->tlv->type = type; | 92 cur->tlv->type = type; |
78 if ((cur->tlv->length = length)) | 93 if ((cur->tlv->length = length)) { |
79 cur->tlv->value = aimbs_getraw(bs, length); | 94 cur->tlv->value = aimbs_getraw(bs, length); |
95 if (!cur->tlv->value) { | |
96 freetlv(&cur->tlv); | |
97 free(cur); | |
98 aim_freetlvchain(&list); | |
99 return NULL; | |
100 } | |
101 } | |
80 | 102 |
81 cur->next = list; | 103 cur->next = list; |
82 list = cur; | 104 list = cur; |
83 } | 105 } |
84 } | 106 } |