emulator: Fix condition check in btdev_create()
PATCH 1/1 emulator: Fix condition check in btdev_create()
This fixes a case where logical '||' was used with constant operand and the condition check always resulted in true.
Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| BTDEV_TYPE_BREDRLE50)
Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| type == BTDEV_TYPE_BREDRLE50)
---
emulator/btdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)emulator/btdev.c +1 -1
@@ -645,7 +645,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)memset (btdev,0 ,sizeof (*btdev));if (type ==BTDEV_TYPE_BREDRLE || type ==BTDEV_TYPE_LE - ||BTDEV_TYPE_BREDRLE50 ) { + || type ==BTDEV_TYPE_BREDRLE50 ) { btdev->crypto =bt_crypto_new ();if (!btdev->crypto) {free (btdev);
Signature · 1 line
2.21.0
Gix, Brian
AppliedApplied.
Quoted 26 lines · Inga Stotland
This fixes a case where logical '||' was used with constant operand and the condition check always resulted in true.
Was: if (type ==
BTDEV_TYPE_BREDRLE|| type ==BTDEV_TYPE_LE|| BTDEV_TYPE_BREDRLE50) Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE || type == BTDEV_TYPE_BREDRLE50) --- emulator/btdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)emulator/btdev.c +1
-1@@ -645,7 +645,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id) memset(btdev, 0, sizeof(*btdev));if (type ==BTDEV_TYPE_BREDRLE || type ==BTDEV_TYPE_LE - ||BTDEV_TYPE_BREDRLE50 ) { + || type ==BTDEV_TYPE_BREDRLE50 ) { btdev->crypto =bt_crypto_new ();if (!btdev->crypto) {free(btdev);