summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-01-24 11:16:15 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-01-24 11:16:15 +0000
commit6f15a199e037d789188b3b89e77ac78acee7812f (patch)
treedbe316a5faecd489c9d31283a554b2b78840a1b3
parent9052739242915a60495d7930ab67debb4ba2ead5 (diff)
Add some buffer length checks
-rw-r--r--audio/headset.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/audio/headset.c b/audio/headset.c
index a02f4fef..6972daf9 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -176,6 +176,9 @@ static int supported_features(struct device *device, const char *buf)
struct headset *hs = device->headset;
int err;
+ if (strlen(buf) < 9)
+ return -EINVAL;
+
hs->hfp_features = strtoul(&buf[8], NULL, 10);
err = headset_send(hs, "\r\n+BRSF=%u\r\n", ag_features);
if (err < 0)
@@ -287,6 +290,9 @@ static int cli_notification(struct device *device, const char *buf)
{
struct headset *hs = device->headset;
+ if (strlen(buf) < 9)
+ return -EINVAL;
+
hs->cli_active = buf[8] == '1' ? TRUE : FALSE;
return headset_send(hs, "\r\nOK\r\n");