Hi Johan, >> + val = (uint16_t *) ¶m->val; >> + maxmsgsize = ntohs(*val); > >Is this unaligned access safe? In theory this is safe :) param-> val should be always aligned to 4 bytes according to sap spec struct sap_parameter { uint8_t id; uint8_t reserved; uint16_t len; uint8_t val[0]; /* * Padding bytes 0-3 bytes */ } __attribute__ ((packed)); However, I tried maxmsgsize = ntohs(bt_get_unaligned((uint16_t *) ¶m->val)); and got gcc error: dereferencing type-punned pointer will break strict-aliasing rules. Strange as it's already used in bluetoothd and it compiles without such errors. Do I missed something ? Thanks for comments and have a look on fixed patch. /Waldek
Attachment:
0003-Sim-Access-Profile-Server.patch
Description: 0003-Sim-Access-Profile-Server.patch