summaryrefslogtreecommitdiffstats
path: root/binding
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2019-04-30 08:45:37 -0700
committerMatt Ranostay <matt.ranostay@konsulko.com>2019-04-30 08:46:37 -0700
commit4e8830e73267d9b62f167cb24ae5d650038be956 (patch)
treecbcfcd314168908a1431137bac51c29bc8d18a4d /binding
parent2da918bb09cb6f5bc50e551fdf4ee1e963a7be0b (diff)
binding: mediaplayer: fix segfault in volume commandhalibut_7.99.1halibut/7.99.17.99.1
When no volume field is passed it caused a null pointer dereference Bug-AGL: SPEC-2368 Change-Id: Ia11ae28b38455a597d1b31a044a711e21928b0cc Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Diffstat (limited to 'binding')
-rw-r--r--binding/afm-mediaplayer-binding.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/binding/afm-mediaplayer-binding.c b/binding/afm-mediaplayer-binding.c
index 5b49694..b25418c 100644
--- a/binding/afm-mediaplayer-binding.c
+++ b/binding/afm-mediaplayer-binding.c
@@ -537,7 +537,15 @@ static void gstreamer_controls(afb_req_t request)
}
case VOLUME_CMD: {
const char *parameter = afb_req_value(request, "volume");
- long int volume = strtol(parameter, NULL, 10);
+ long int volume;
+
+ if (!parameter) {
+ afb_req_fail(request, "failed", "invalid volume");
+ return;
+ }
+
+ volume = strtol(parameter, NULL, 10);
+ errno = 0;
if (volume == 0 && errno) {
afb_req_fail(request, "failed", "invalid volume");