Mercurial > pidgin
comparison src/protocols/msn/msg.c @ 11001:0c9e936c154b
[gaim-migrate @ 12851]
This is basically the same scenario as the previous fix.
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Fri, 10 Jun 2005 04:42:40 +0000 |
parents | 771c510655c7 |
children | 5ea38c98ff30 |
comparison
equal
deleted
inserted
replaced
11000:218cccfb8e48 | 11001:0c9e936c154b |
---|---|
157 void | 157 void |
158 msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) | 158 msn_message_parse_slp_body(MsnMessage *msg, const char *body, size_t len) |
159 { | 159 { |
160 MsnSlpHeader header; | 160 MsnSlpHeader header; |
161 const char *tmp; | 161 const char *tmp; |
162 int body_len; | |
162 | 163 |
163 tmp = body; | 164 tmp = body; |
165 | |
166 if (len < sizeof(header)) { | |
167 g_return_if_reached(); | |
168 } | |
164 | 169 |
165 /* Import the header. */ | 170 /* Import the header. */ |
166 memcpy(&header, tmp, sizeof(header)); | 171 memcpy(&header, tmp, sizeof(header)); |
167 tmp += sizeof(header); | 172 tmp += sizeof(header); |
168 | 173 |
175 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); | 180 msg->msnslp_header.ack_id = GUINT32_FROM_LE(header.ack_id); |
176 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); | 181 msg->msnslp_header.ack_sub_id = GUINT32_FROM_LE(header.ack_sub_id); |
177 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); | 182 msg->msnslp_header.ack_size = GUINT64_FROM_LE(header.ack_size); |
178 | 183 |
179 /* Import the body. */ | 184 /* Import the body. */ |
185 body_len = len - (tmp - body); | |
180 /* msg->body_len = msg->msnslp_header.length; */ | 186 /* msg->body_len = msg->msnslp_header.length; */ |
181 msg->body_len = len - (tmp - body); | 187 |
182 | 188 if (body_len > 0) { |
183 if (msg->body_len > 0) | 189 msg->body_len = len - (tmp - body); |
184 msg->body = g_memdup(tmp, msg->body_len); | 190 msg->body = g_memdup(tmp, msg->body_len); |
185 | 191 tmp += body_len; |
186 tmp += msg->body_len; | 192 } |
187 } | 193 } |
188 | 194 |
189 void | 195 void |
190 msn_message_parse_payload(MsnMessage *msg, | 196 msn_message_parse_payload(MsnMessage *msg, |
191 const char *payload, size_t payload_len) | 197 const char *payload, size_t payload_len) |