mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-01-08 11:20:13 +01:00
wpctl: ensure that the result of strtol() is < G_MAXUINT32
Fixes overflows on 64-bit architectures Closes #173
This commit is contained in:
parent
46ab414a04
commit
cfee1f0c65
1 changed files with 6 additions and 6 deletions
|
|
@ -384,7 +384,7 @@ inspect_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
}
|
||||
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
if (id <= 0) {
|
||||
if (id <= 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid number", argv[2]);
|
||||
return FALSE;
|
||||
|
|
@ -591,7 +591,7 @@ set_default_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
}
|
||||
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
if (id <= 0) {
|
||||
if (id <= 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid number", argv[2]);
|
||||
return FALSE;
|
||||
|
|
@ -680,7 +680,7 @@ set_volume_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
float volume = strtof (argv[3], NULL);
|
||||
if (id <= 0) {
|
||||
if (id <= 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid number", argv[2]);
|
||||
return FALSE;
|
||||
|
|
@ -764,7 +764,7 @@ set_mute_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
}
|
||||
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
if (id <= 0) {
|
||||
if (id <= 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid number", argv[2]);
|
||||
return FALSE;
|
||||
|
|
@ -870,7 +870,7 @@ set_profile_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
int index = atoi (argv[3]);
|
||||
if (id < 0) {
|
||||
if (id < 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid index", argv[2]);
|
||||
return FALSE;
|
||||
|
|
@ -925,7 +925,7 @@ clear_default_parse_positional (gint argc, gchar ** argv, GError **error)
|
|||
|
||||
if (argc >= 3) {
|
||||
long id = strtol (argv[2], NULL, 10);
|
||||
if (id < 0) {
|
||||
if (id < 0 || id >= G_MAXUINT32) {
|
||||
g_set_error (error, wpctl_error_domain_quark(), 0,
|
||||
"'%s' is not a valid number", argv[2]);
|
||||
return FALSE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue