comparison mmst.c @ 6290:a1500faf3a7e libavformat

Check the status code of each server responses, and fail if it indicates a problem. Patch by Zhentan Feng <spyfeng gmail com>.
author rbultje
date Tue, 20 Jul 2010 15:01:06 +0000
parents fb720b9d8ee1
children 3a8dfc455ff0
comparison
equal deleted inserted replaced
6289:fb720b9d8ee1 6290:a1500faf3a7e
258 if(AV_RL32(mms->in_buffer + 4)==0xb00bface) { 258 if(AV_RL32(mms->in_buffer + 4)==0xb00bface) {
259 mms->incoming_flags= mms->in_buffer[3]; 259 mms->incoming_flags= mms->in_buffer[3];
260 read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4); 260 read_result= url_read_complete(mms->mms_hd, mms->in_buffer+8, 4);
261 if(read_result == 4) { 261 if(read_result == 4) {
262 int length_remaining= AV_RL32(mms->in_buffer+8) + 4; 262 int length_remaining= AV_RL32(mms->in_buffer+8) + 4;
263 int hr;
263 264
264 dprintf(NULL, "Length remaining is %d\n", length_remaining); 265 dprintf(NULL, "Length remaining is %d\n", length_remaining);
265 // read the rest of the packet. 266 // read the rest of the packet.
266 if (length_remaining < 0 267 if (length_remaining < 0
267 || length_remaining > sizeof(mms->in_buffer) - 12) { 268 || length_remaining > sizeof(mms->in_buffer) - 12) {
273 length_remaining) ; 274 length_remaining) ;
274 if (read_result == length_remaining) { 275 if (read_result == length_remaining) {
275 packet_type= AV_RL16(mms->in_buffer+36); 276 packet_type= AV_RL16(mms->in_buffer+36);
276 } else { 277 } else {
277 dprintf(NULL, "read for packet type failed%d!\n", read_result); 278 dprintf(NULL, "read for packet type failed%d!\n", read_result);
279 return -1;
280 }
281 hr = AV_RL32(mms->in_buffer + 40);
282 if (hr) {
283 dprintf(NULL, "The server side send back error code:0x%x\n", hr);
278 return -1; 284 return -1;
279 } 285 }
280 } else { 286 } else {
281 dprintf(NULL, "read for length remaining failed%d!\n", read_result); 287 dprintf(NULL, "read for length remaining failed%d!\n", read_result);
282 return -1; 288 return -1;