From 99292329e06ea428a7a98e6ced8efe81e9453629 Mon Sep 17 00:00:00 2001 From: Michael Janssen Date: Tue, 14 Apr 2015 15:07:01 -0700 Subject: [PATCH] core/advertising: improve errors for add advertising Use the error string and check the size of the response when we get response from the add advertising command. --- src/advertising.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/advertising.c b/src/advertising.c index 46de9b48d..7d69ee1cd 100644 --- a/src/advertising.c +++ b/src/advertising.c @@ -402,7 +402,13 @@ static void add_advertising_callback(uint8_t status, uint16_t length, const struct mgmt_rp_add_advertising *rp = param; if (status || !param) { - error("Failed to add advertising MGMT"); + error("Failed to add advertisement: %s (0x%02x)", + mgmt_errstr(status), status); + return; + } + + if (length < sizeof(*rp)) { + error("Wrong size of add advertising response"); return; } -- 2.47.3