Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
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
Commits
d85fae56
Commit
d85fae56
authored
Aug 20, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
help: remove large but unchecked fixed-size buffer
parent
f8d541e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
20 deletions
+45
-20
src/config/help.c
src/config/help.c
+45
-20
No files found.
src/config/help.c
View file @
d85fae56
...
@@ -352,7 +352,7 @@ static void print_item(const module_t *m, const module_config_t *item,
...
@@ -352,7 +352,7 @@ static void print_item(const module_t *m, const module_config_t *item,
#endif
#endif
const
char
*
bra
=
OPTION_VALUE_SEP
"<"
,
*
type
,
*
ket
=
">"
;
const
char
*
bra
=
OPTION_VALUE_SEP
"<"
,
*
type
,
*
ket
=
">"
;
const
char
*
prefix
=
NULL
,
*
suffix
=
NULL
;
const
char
*
prefix
=
NULL
,
*
suffix
=
NULL
;
char
psz_buffer
[
10000
];
// XXX
char
*
typebuf
=
NULL
;
switch
(
CONFIG_CLASS
(
item
->
i_type
))
switch
(
CONFIG_CLASS
(
item
->
i_type
))
{
{
...
@@ -379,43 +379,64 @@ static void print_item(const module_t *m, const module_config_t *item,
...
@@ -379,43 +379,64 @@ static void print_item(const module_t *m, const module_config_t *item,
type
=
_
(
"string"
);
type
=
_
(
"string"
);
if
(
item
->
list_count
>
0
)
if
(
item
->
list_count
>
0
)
{
{
size_t
len
=
0
;
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
len
+=
strlen
(
item
->
list
.
psz
[
i
])
+
1
;
typebuf
=
malloc
(
len
);
if
(
typebuf
==
NULL
)
break
;
bra
=
OPTION_VALUE_SEP
"{"
;
bra
=
OPTION_VALUE_SEP
"{"
;
type
=
psz_buffer
;
type
=
typebuf
;
psz_buffer
[
0
]
=
'\0'
;
ket
=
"}"
;
*
typebuf
=
0
;
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
{
{
if
(
i
>
0
)
if
(
i
>
0
)
strcat
(
psz_buffer
,
","
);
strcat
(
typebuf
,
","
);
strcat
(
psz_buffer
,
item
->
list
.
psz
[
i
]);
strcat
(
typebuf
,
item
->
list
.
psz
[
i
]);
}
}
ket
=
"}"
;
}
}
break
;
break
;
case
CONFIG_ITEM_INTEGER
:
case
CONFIG_ITEM_INTEGER
:
type
=
_
(
"integer"
);
type
=
_
(
"integer"
);
if
(
item
->
min
.
i
!=
0
||
item
->
max
.
i
!=
0
)
{
sprintf
(
psz_buffer
,
"%s [%"
PRId64
" .. %"
PRId64
"]"
,
type
,
item
->
min
.
i
,
item
->
max
.
i
);
type
=
psz_buffer
;
}
if
(
item
->
list_count
>
0
)
if
(
item
->
list_count
>
0
)
{
{
size_t
len
=
0
;
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
len
+=
strlen
(
item
->
list_text
[
i
])
+
4
*
sizeof
(
int
)
+
5
;
typebuf
=
malloc
(
len
);
if
(
typebuf
==
NULL
)
break
;
bra
=
OPTION_VALUE_SEP
"{"
;
bra
=
OPTION_VALUE_SEP
"{"
;
type
=
psz_buffer
;
type
=
typebuf
;
psz_buffer
[
0
]
=
'\0'
;
ket
=
"}"
;
*
typebuf
=
0
;
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
for
(
unsigned
i
=
0
;
i
<
item
->
list_count
;
i
++
)
{
{
if
(
i
!=
0
)
if
(
i
!=
0
)
strcat
(
psz_buffer
,
", "
);
strcat
(
typebuf
,
", "
);
sprintf
(
psz_buffer
+
strlen
(
psz_buffer
),
"%i (%s)"
,
sprintf
(
typebuf
+
strlen
(
typebuf
),
"%i (%s)"
,
item
->
list
.
i
[
i
],
item
->
list
.
i
[
i
],
module_gettext
(
m
,
item
->
list_text
[
i
]));
module_gettext
(
m
,
item
->
list_text
[
i
]));
}
}
ket
=
"}"
;
}
else
if
(
item
->
min
.
i
!=
0
||
item
->
max
.
i
!=
0
)
{
if
(
asprintf
(
&
typebuf
,
"%s [%"
PRId64
" .. %"
PRId64
"]"
,
type
,
item
->
min
.
i
,
item
->
max
.
i
)
>=
0
)
type
=
typebuf
;
else
typebuf
=
NULL
;
}
}
break
;
break
;
...
@@ -423,9 +444,11 @@ static void print_item(const module_t *m, const module_config_t *item,
...
@@ -423,9 +444,11 @@ static void print_item(const module_t *m, const module_config_t *item,
type
=
_
(
"float"
);
type
=
_
(
"float"
);
if
(
item
->
min
.
f
!=
0
.
f
||
item
->
max
.
f
!=
0
.
f
)
if
(
item
->
min
.
f
!=
0
.
f
||
item
->
max
.
f
!=
0
.
f
)
{
{
sprintf
(
psz_buffer
,
"%s [%f .. %f]"
,
type
,
if
(
asprintf
(
&
typebuf
,
"%s [%f .. %f]"
,
type
,
item
->
min
.
f
,
item
->
max
.
f
);
item
->
min
.
f
,
item
->
max
.
f
)
>=
0
)
type
=
psz_buffer
;
type
=
typebuf
;
else
typebuf
=
NULL
;
}
}
break
;
break
;
...
@@ -484,6 +507,8 @@ static void print_item(const module_t *m, const module_config_t *item,
...
@@ -484,6 +507,8 @@ static void print_item(const module_t *m, const module_config_t *item,
print_desc
(
module_gettext
(
m
,
item
->
psz_longtext
),
print_desc
(
module_gettext
(
m
,
item
->
psz_longtext
),
LINE_START
+
2
,
false
);
LINE_START
+
2
,
false
);
}
}
free
(
typebuf
);
}
}
static
bool
module_match
(
const
module_t
*
m
,
const
char
*
pattern
,
bool
strict
)
static
bool
module_match
(
const
module_t
*
m
,
const
char
*
pattern
,
bool
strict
)
...
...
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