From 0dfe8a30bc6fe92d3fa5fba14645099659e9142a Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 22 Feb 2006 21:31:35 +0000 Subject: Fix crash in get alias function --- hcid/dbus-device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hcid/dbus-device.c b/hcid/dbus-device.c index 54646b80..b4dc5d68 100644 --- a/hcid/dbus-device.c +++ b/hcid/dbus-device.c @@ -182,13 +182,16 @@ static DBusMessage* handle_dev_get_alias_req(DBusMessage *msg, void *data) DBusMessage *reply; char str[249], *str_ptr = str, *addr_ptr; bdaddr_t bdaddr; + int err; dbus_message_iter_init(msg, &iter); dbus_message_iter_get_basic(&iter, &addr_ptr); str2ba(addr_ptr, &bdaddr); - get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str)); + err = get_device_alias(dbus_data->dev_id, &bdaddr, str, sizeof(str)); + if (err < 0) + return bluez_new_failure_msg(msg, BLUEZ_ESYSTEM_OFFSET | -err); reply = dbus_message_new_method_return(msg); -- cgit