Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-gpu
Commits
aa5633ce
Commit
aa5633ce
authored
Aug 14, 2008
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use asprintf instead of malloc+sprintf (and check the return value)
parent
ec9ad1e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
modules/access/cdda.c
modules/access/cdda.c
+17
-15
No files found.
modules/access/cdda.c
View file @
aa5633ce
...
@@ -443,26 +443,28 @@ static int GetTracks( access_t *p_access,
...
@@ -443,26 +443,28 @@ static int GetTracks( access_t *p_access,
{
{
msg_Dbg
(
p_access
,
"track[%d] start=%d"
,
i
,
p_sys
->
p_sectors
[
i
]
);
msg_Dbg
(
p_access
,
"track[%d] start=%d"
,
i
,
p_sys
->
p_sectors
[
i
]
);
char
*
psz_uri
,
*
psz_opt
,
*
psz_first
,
*
psz_last
;
char
*
psz_uri
,
*
psz_opt
,
*
psz_first
,
*
psz_last
;
int
i_path_len
=
p_access
->
psz_path
?
strlen
(
p_access
->
psz_path
)
:
0
;
psz_name
=
(
char
*
)
malloc
(
strlen
(
_
(
"Audio CD - Track "
)
)
+
5
);
if
(
asprintf
(
&
psz_uri
,
"cdda://%s"
,
p_access
->
psz_path
?
p_access
->
psz_path
:
""
)
==
-
1
)
psz_opt
=
(
char
*
)
malloc
(
strlen
(
"cdda-track="
)
+
3
);
psz_uri
=
NULL
;
psz_first
=
(
char
*
)
malloc
(
strlen
(
"cdda-first-sector="
)
+
7
);
if
(
asprintf
(
&
psz_opt
,
"cdda-track=%i"
,
i
+
1
)
==
-
1
)
psz_last
=
(
char
*
)
malloc
(
strlen
(
"cdda-last-sector="
)
+
7
);
psz_opt
=
NULL
;
psz_uri
=
(
char
*
)
malloc
(
i_path_len
+
13
);
if
(
asprintf
(
&
psz_first
,
"cdda-first-sector=%i"
,
p_sys
->
p_sectors
[
i
]
)
==
-
1
)
psz_first
=
NULL
;
snprintf
(
psz_uri
,
i_path_len
+
13
,
"cdda://%s"
,
p_access
->
psz_path
?
p_access
->
psz_path
:
""
);
sprintf
(
psz_opt
,
"cdda-track=%i"
,
i
+
1
);
sprintf
(
psz_first
,
"cdda-first-sector=%i"
,
p_sys
->
p_sectors
[
i
]
);
// if( i != i_titles -1 )
// if( i != i_titles -1 )
sprintf
(
psz_last
,
"cdda-last-sector=%i"
,
p_sys
->
p_sectors
[
i
+
1
]
);
// {
if
(
asprintf
(
&
psz_last
,
"cdda-last-sector=%i"
,
p_sys
->
p_sectors
[
i
+
1
]
)
==
-
1
)
psz_last
=
NULL
;
// }
// else
// else
// sprintf( psz_last, "cdda-last-sector=%i", 1242 /* FIXME */);
// {
// if( asprintf( &psz_last, "cdda-last-sector=%i", 1242 /* FIXME */) == -1 )
// psz_last = NULL;
// }
/* Define a "default name" */
/* Define a "default name" */
sprintf
(
psz_name
,
_
(
"Audio CD - Track %i"
),
(
i
+
1
)
);
if
(
asprintf
(
&
psz_name
,
_
(
"Audio CD - Track %i"
),
(
i
+
1
)
)
==
-
1
)
psz_name
=
NULL
;
/* Create playlist items */
/* Create playlist items */
p_input_item
=
input_ItemNewWithType
(
VLC_OBJECT
(
p_playlist
),
p_input_item
=
input_ItemNewWithType
(
VLC_OBJECT
(
p_playlist
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment