kscheff / BlueBasic

BASIC interpreter for CC2540 and CC2541 Bluetooth LE chips
11 stars 9 forks source link

advertised name ending with ?? not including mac address, possible memory corruption #10

Closed fanoush closed 5 years ago

fanoush commented 5 years ago

Hi, I noticed this fork no longer replaces ?? in name with mac address data. It looks like the code is rewriting hardcoded offset here https://github.com/kscheff/BlueBasic/blob/serial_fix/BLE-CC254x-1.4.2.2/Projects/ble/Profiles/Roles/CC254x/peripheral.c#L1055 while the structure now has different (smaller?) size here https://github.com/kscheff/BlueBasic/blob/serial_fix/BLE-CC254x-1.4.2.2/Projects/ble/BlueBasic/Source/BlueBasic.c#L226 So most probably it overwrites other memory and may cause corruption.

I have fixed it in my code and made it relative by searching and replacing string '??' from the beginning but you can also fix it by simply changing the offset. Are you interested in my code? BTW when adding more code I had linking errors so I had to optimize it a bit, it looks current code is near size limits of flash bank.

kscheff commented 5 years ago

Thanks, this was some wired behavior... I fixed it in commit 5615dbf6cd6451e83d640c7002b5ab6088a2e55d