Mercurial > mplayer.hg
comparison libmpdemux/realrtsp/real.c @ 12271:4adb4a3b52a2
More bounds checking fixes (thnaks to Miguel Freitas)
author | rtognimp |
---|---|
date | Sun, 25 Apr 2004 00:17:23 +0000 |
parents | 096072d234c6 |
children | 5c83c247bad1 |
comparison
equal
deleted
inserted
replaced
12270:24c13ef4f42b | 12271:4adb4a3b52a2 |
---|---|
659 *buffer = xbuffer_ensure_size(*buffer, 12+size); | 659 *buffer = xbuffer_ensure_size(*buffer, 12+size); |
660 rmff_dump_pheader(&ph, *buffer); | 660 rmff_dump_pheader(&ph, *buffer); |
661 size-=12; | 661 size-=12; |
662 n=rtsp_read_data(rtsp_session, (*buffer)+12, size); | 662 n=rtsp_read_data(rtsp_session, (*buffer)+12, size); |
663 | 663 |
664 return n+12; | 664 return (n <= 0) ? 0 : n+12; |
665 } | 665 } |
666 | 666 |
667 int convert_timestamp(char *str, int *sec, int *msec) { | 667 int convert_timestamp(char *str, int *sec, int *msec) { |
668 int hh, mm, ss, ms = 0; | 668 int hh, mm, ss, ms = 0; |
669 if (sscanf(str, "%d:%d:%d.%d", &hh, &mm, &ss, &ms) < 3) { | 669 if (sscanf(str, "%d:%d:%d.%d", &hh, &mm, &ss, &ms) < 3) { |
742 printf("real: Stream description size: %i\n", size); | 742 printf("real: Stream description size: %i\n", size); |
743 #endif | 743 #endif |
744 | 744 |
745 description=malloc(sizeof(char)*(size+1)); | 745 description=malloc(sizeof(char)*(size+1)); |
746 | 746 |
747 rtsp_read_data(rtsp_session, description, size); | 747 if( rtsp_read_data(rtsp_session, description, size) <= 0) { |
748 buf = xbuffer_free(buf); | |
749 return NULL; | |
750 } | |
748 description[size]=0; | 751 description[size]=0; |
749 | 752 |
750 /* parse sdp (sdpplin) and create a header and a subscribe string */ | 753 /* parse sdp (sdpplin) and create a header and a subscribe string */ |
751 subscribe = xbuffer_init(256); | 754 subscribe = xbuffer_init(256); |
752 strcpy(subscribe, "Subscribe: "); | 755 strcpy(subscribe, "Subscribe: "); |