Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
e172874c
Commit
e172874c
authored
Oct 23, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command: check over/underflows in check_int()
The "long" result of strtol() was implicitly casted down to a 32 bit integer. Add some range checking instead.
parent
95ae1d9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
command.c
src/command.c
+13
-2
No files found.
src/command.c
View file @
e172874c
...
...
@@ -129,12 +129,13 @@ check_uint32(struct client *client, uint32_t *dst,
}
static
bool
mpd_fprintf__
check_int
(
struct
client
*
client
,
int
*
dst
,
check_int
(
struct
client
*
client
,
int
*
value_r
,
const
char
*
s
,
const
char
*
fmt
,
...)
{
char
*
test
;
long
value
;
*
dst
=
strtol
(
s
,
&
test
,
10
);
value
=
strtol
(
s
,
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
va_list
args
;
va_start
(
args
,
fmt
);
...
...
@@ -142,6 +143,16 @@ check_int(struct client *client, int *dst,
va_end
(
args
);
return
false
;
}
#if LONG_MAX > INT_MAX
if
(
value
<
INT_MIN
||
value
>
INT_MAX
)
{
command_error
(
client
,
ACK_ERROR_ARG
,
"Number too large: %s"
,
s
);
return
false
;
}
#endif
*
value_r
=
(
int
)
value
;
return
true
;
}
...
...
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