Revision 2a21adf9

View differences:

libavformat/rtsp.c
1451 1451
    /* search for options */
1452 1452
    option_list = strchr(path, '?');
1453 1453
    if (option_list) {
1454
        filename = strchr(s->filename, '?');
1454
        /* Strip out the RTSP specific options, write out the rest of
1455
         * the options back into the same string. */
1456
        filename = option_list;
1455 1457
        while (option_list) {
1456 1458
            /* move the option pointer */
1457 1459
            option = ++option_list;
......
1467 1469
            } else if (!strcmp(option, "tcp")) {
1468 1470
                lower_transport_mask = (1<< RTSP_LOWER_TRANSPORT_TCP);
1469 1471
            } else {
1470
                strcpy(++filename, option);
1471
                filename += strlen(option);
1472
                /* Write options back into the buffer, using memmove instead
1473
                 * of strcpy since the strings may overlap. */
1474
                int len = strlen(option);
1475
                memmove(++filename, option, len);
1476
                filename += len;
1472 1477
                if (option_list) *filename = '&';
1473 1478
            }
1474 1479
        }
......
1505 1510
                    NULL, 0, NI_NUMERICHOST);
1506 1511
    }
1507 1512

  
1513
    /* Construct the URI used in request; this is similar to s->filename,
1514
     * but with authentication credentials removed and RTSP specific options
1515
     * stripped out. */
1516
    ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL,
1517
                host, port, "%s", path);
1508 1518
    /* request options supported by the server; this also detects server
1509 1519
     * type */
1510
    av_strlcpy(rt->control_uri, s->filename,
1511
               sizeof(rt->control_uri));
1512 1520
    for (rt->server_type = RTSP_SERVER_RTP;;) {
1513 1521
        snprintf(cmd, sizeof(cmd),
1514 1522
                 "OPTIONS %s RTSP/1.0\r\n", rt->control_uri);

Also available in: Unified diff