bnep.c (b56e8b561bce450f5cd8828749be22a67c2bd9ec) bnep.c (d4d9523ffb96ab82dbbc671e072dba0b7c1b3212)
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 838 unchanged lines hidden (view full) ---

847 uuid_offset = 2;
848 break;
849 default:
850 log_error("BNEP_CONNECTION_REQUEST: Invalid UUID size %d, l2cap_cid: %d!", channel->state, channel->l2cap_cid);
851 response_code = BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE;
852 break;
853 }
854
1/*
2 * Copyright (C) 2014 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 838 unchanged lines hidden (view full) ---

847 uuid_offset = 2;
848 break;
849 default:
850 log_error("BNEP_CONNECTION_REQUEST: Invalid UUID size %d, l2cap_cid: %d!", channel->state, channel->l2cap_cid);
851 response_code = BNEP_RESP_SETUP_INVALID_SERVICE_UUID_SIZE;
852 break;
853 }
854
855 /* Check bits 16-31 of UUID */
856 if (uuid_size > 2){
857 uint16_t dest_prefix = big_endian_read_16(packet, 2);
858 if (dest_prefix != 0){
859 response_code = BNEP_RESP_SETUP_INVALID_DEST_UUID;
860 }
861 uint16_t src_prefix = big_endian_read_16(packet, 2 + uuid_size);
862 if (src_prefix != 0){
863 response_code = BNEP_RESP_SETUP_INVALID_SOURCE_UUID;
864 }
865 }
866
867 /* check bits 32-127 of UUID */
868 if (uuid_size == 16){
869 if (uuid_has_bluetooth_prefix(&packet[2]) == false){
870 response_code = BNEP_RESP_SETUP_INVALID_DEST_UUID;
871 }
872 if (uuid_has_bluetooth_prefix(&packet[2+16]) == false){
873 response_code = BNEP_RESP_SETUP_INVALID_SOURCE_UUID;
874 }
875 }
876
855 /* Check source and destination UUIDs for valid combinations */
856 if (response_code == BNEP_RESP_SETUP_SUCCESS) {
857 channel->uuid_dest = big_endian_read_16(packet, 2 + uuid_offset);
858 channel->uuid_source = big_endian_read_16(packet, 2 + uuid_offset + uuid_size);
859
860 if ((channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU) &&
861 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_NAP) &&
862 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_GN)) {

--- 832 unchanged lines hidden ---
877 /* Check source and destination UUIDs for valid combinations */
878 if (response_code == BNEP_RESP_SETUP_SUCCESS) {
879 channel->uuid_dest = big_endian_read_16(packet, 2 + uuid_offset);
880 channel->uuid_source = big_endian_read_16(packet, 2 + uuid_offset + uuid_size);
881
882 if ((channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_PANU) &&
883 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_NAP) &&
884 (channel->uuid_dest != BLUETOOTH_SERVICE_CLASS_GN)) {

--- 832 unchanged lines hidden ---