Changeset 09ffa83994759a32ab35b90ad4bade5bf71ccec4
- Timestamp:
- 06/06/07 18:40:48
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1181148048 +0000
- git-parent:
[b88d6d15440ec6cee17f382c6147b8ff04d2051f]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1181148048 +0000
- Message:
- Only allow letters, digits and slash in access/demux specification
(fixes problem with most-but-not-all filenames containing a colon)
- Only allow letters as Windows drives
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r9d8ceda |
r09ffa83 |
|
| 2538 | 2538 | } |
|---|
| 2539 | 2539 | |
|---|
| | 2540 | |
|---|
| | 2541 | static inline vlc_bool_t IsValidAccess( const char *psz ) |
|---|
| | 2542 | { |
|---|
| | 2543 | unsigned char c; |
|---|
| | 2544 | |
|---|
| | 2545 | while( ( c = *psz ) != '\0' ) |
|---|
| | 2546 | { |
|---|
| | 2547 | if( c == ':' ) |
|---|
| | 2548 | return VLC_TRUE; |
|---|
| | 2549 | |
|---|
| | 2550 | if( !isascii( c ) || !isalnum( c ) || ( c != '/' ) ) |
|---|
| | 2551 | return VLC_FALSE; |
|---|
| | 2552 | |
|---|
| | 2553 | psz++; |
|---|
| | 2554 | } |
|---|
| | 2555 | return VLC_FALSE; /* should not happen though */ |
|---|
| | 2556 | } |
|---|
| | 2557 | |
|---|
| | 2558 | |
|---|
| 2540 | 2559 | /***************************************************************************** |
|---|
| 2541 | 2560 | * MRLSplit: parse the access, demux and url part of the |
|---|
| … | … | |
| 2549 | 2568 | const char *psz_demux = ""; |
|---|
| 2550 | 2569 | char *psz_path; |
|---|
| 2551 | | char *psz, *psz_check; |
|---|
| | 2570 | char *psz; |
|---|
| 2552 | 2571 | |
|---|
| 2553 | 2572 | psz = strchr( psz_dup, ':' ); |
|---|
| 2554 | 2573 | |
|---|
| 2555 | | /* '@' not allowed in access/demux part */ |
|---|
| 2556 | | psz_check = strchr( psz_dup, '@' ); |
|---|
| 2557 | | if( psz_check && psz_check < psz ) psz = 0; |
|---|
| 2558 | | |
|---|
| | 2574 | if( psz != NULL ) |
|---|
| | 2575 | { |
|---|
| | 2576 | /* Guess whether ':' is part of a local filename, or separates |
|---|
| | 2577 | * access/demux from path */ |
|---|
| | 2578 | if( !IsValidAccess( psz_dup ) ) |
|---|
| | 2579 | psz = NULL; |
|---|
| 2559 | 2580 | #if defined( WIN32 ) || defined( UNDER_CE ) |
|---|
| 2560 | | if( psz - psz_dup == 1 ) |
|---|
| 2561 | | { |
|---|
| 2562 | | msg_Dbg( p_input, "drive letter %c: found in source", *psz_dup ); |
|---|
| 2563 | | psz_path = psz_dup; |
|---|
| 2564 | | } |
|---|
| 2565 | | else |
|---|
| | 2581 | else if( ( psz - psz_dup == 1 ) && isalpha( psz_dup[0] ) ) |
|---|
| | 2582 | { |
|---|
| | 2583 | msg_Dbg( p_input, "drive letter %c: found in source", *psz_dup ); |
|---|
| | 2584 | psz = NULL; |
|---|
| | 2585 | } |
|---|
| 2566 | 2586 | #endif |
|---|
| 2567 | | |
|---|
| 2568 | | if( psz ) |
|---|
| | 2587 | } |
|---|
| | 2588 | |
|---|
| | 2589 | if( psz != NULL ) |
|---|
| 2569 | 2590 | { |
|---|
| 2570 | 2591 | *psz++ = '\0'; |
|---|