diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-04-24 10:33:19 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2004-04-24 10:33:19 +0000 |
commit | 31d8127a156a01e5f664374543b8f1c38ad15a85 (patch) | |
tree | a4e6da4e1f1e01205be32f026571331c41793db9 /libmpdemux/realrtsp/sdpplin.c | |
parent | ebfa9397279dff0f73686eba0f48c9fd9c0c6e9b (diff) | |
download | mpv-31d8127a156a01e5f664374543b8f1c38ad15a85.tar.bz2 mpv-31d8127a156a01e5f664374543b8f1c38ad15a85.tar.xz |
Some sanity and bound checking
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12267 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/realrtsp/sdpplin.c')
-rw-r--r-- | libmpdemux/realrtsp/sdpplin.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libmpdemux/realrtsp/sdpplin.c b/libmpdemux/realrtsp/sdpplin.c index ce78ffc035..229f4a0e68 100644 --- a/libmpdemux/realrtsp/sdpplin.c +++ b/libmpdemux/realrtsp/sdpplin.c @@ -96,13 +96,19 @@ static char *b64_decode(const char *in, char *out, int *size) static char *nl(char *data) { - return strchr(data,'\n')+1; + char *nlptr = (data) ? strchr(data,'\n') : NULL; + return (nlptr) ? nlptr + 1 : NULL; } static int filter(const char *in, const char *filter, char **out) { int flen=strlen(filter); - int len=strchr(in,'\n')-in; + int len; + + if (!in) + return 0; + + len = (strchr(in,'\n')) ? strchr(in,'\n')-in : strlen(in); if (!strncmp(in,filter,flen)) { @@ -135,7 +141,7 @@ static sdpplin_stream_t *sdpplin_parse_stream(char **data) { } *data=nl(*data); - while (**data && *data[0]!='m') { + while (*data && **data && *data[0]!='m') { handled=0; @@ -236,7 +242,7 @@ sdpplin_t *sdpplin_parse(char *data) { int handled; int len; - while (*data) { + while (data && *data) { handled=0; |