Commit 3e7b45b0 authored by Rémi Duraffort's avatar Rémi Duraffort

realrtsp: fix read after the end of the string if the input buffer length isn't a multiple of 4.

parent 520eaf2f
...@@ -54,10 +54,11 @@ static char *b64_decode(const char *in, char *out, int *size) { ...@@ -54,10 +54,11 @@ static char *b64_decode(const char *in, char *out, int *size) {
k=0; k=0;
/*CONSTANTCONDITION*/ /*CONSTANTCONDITION*/
for (j=0; j<strlen(in); j+=4) { int in_len = strlen(in);
for (j=0; j < in_len; j+=4) {
char a[4], b[4]; char a[4], b[4];
for (i = 0; i < 4; i++) { for (i = 0; i < 4 && j + i < in_len; i++) {
int c = in[i+j]; int c = in[i+j];
if (dtable[c] & 0x80) { if (dtable[c] & 0x80) {
...@@ -388,3 +389,4 @@ void sdpplin_free(sdpplin_t *description) { ...@@ -388,3 +389,4 @@ void sdpplin_free(sdpplin_t *description) {
free( description->range ); free( description->range );
free( description ); free( description );
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment