client/gatt: Check write_value() retval

Error: CHECKED_RETURN (CWE-252): [#def35]
client/gatt.c:3191:3: check_return: Calling "write_value" without checking return value (as is done elsewhere 5 out of 6 times).
client/gatt.c:2371:2: example_checked: Example 1: "write_value(&chrc->value_len, &chrc->value, value, value_len, aad->offset, chrc->max_val_len)" has its value checked in "write_value(&chrc->value_len, &chrc->value, value, value_len, aad->offset, chrc->max_val_len)".
client/gatt.c:2502:2: example_checked: Example 2: "write_value(&chrc->value_len, &chrc->value, value, value_len, offset, chrc->max_val_len)" has its value checked in "write_value(&chrc->value_len, &chrc->value, value, value_len, offset, chrc->max_val_len)".
client/gatt.c:2919:2: example_checked: Example 3: "write_value(&desc->value_len, &desc->value, value, value_len, offset, desc->max_val_len)" has its value checked in "write_value(&desc->value_len, &desc->value, value, value_len, offset, desc->max_val_len)".
client/gatt.c:759:3: example_checked: Example 4: "write_value(&c->value_len, &c->value, value, value_len, offset, c->max_val_len)" has its value checked in "write_value(&c->value_len, &c->value, value, value_len, offset, c->max_val_len)".
client/gatt.c:775:3: example_checked: Example 5: "write_value(&d->value_len, &d->value, value, value_len, offset, d->max_val_len)" has its value checked in "write_value(&d->value_len, &d->value, value, value_len, offset, d->max_val_len)".
3189|			}
3190|
3191|->			write_value(&chrc->value_len, &chrc->value, value, len,
3192|					0, chrc->max_val_len);
This commit is contained in:
Bastien Nocera 2024-05-10 14:10:14 +02:00 committed by Luiz Augusto von Dentz
parent 1ba9e5f21c
commit 4262170a79

View File

@ -3197,10 +3197,14 @@ static void proxy_property_changed(GDBusProxy *proxy, const char *name,
dbus_message_iter_get_fixed_array(&array, &value, &len);
}
write_value(&chrc->value_len, &chrc->value, value, len,
0, chrc->max_val_len);
if (write_value(&chrc->value_len, &chrc->value, value, len,
0, chrc->max_val_len)) {
bt_shell_printf("Unable to update property value for "
"%s\n", name);
} else {
bt_shell_hexdump(value, len);
}
}
g_dbus_emit_property_changed(conn, chrc->path, CHRC_INTERFACE, name);
}