--- a/gst-libs/gst/rtsp/gstrtspconnection.c 2012-02-17 09:49:52.000000000 -0500 +++ b/gst-libs/gst/rtsp/gstrtspconnection_1.c 2019-05-07 07:54:18.894000000 -0400 @@ -2007,7 +2007,7 @@ build_next (GstRTSPBuilder * builder, Gs maxlen = sizeof (conn->session_id) - 1; /* the sessionid can have attributes marked with ; * Make sure we strip them */ - for (i = 0; session_id[i] != '\0'; i++) { + for (i = 0; i < maxlen && session_id[i] != '\0'; i++) { if (session_id[i] == ';') { maxlen = i; /* parse timeout */