Commit 07dcca4
committed
EncryptedBatteryMonitor: fix memory management bugs
There was a buffer overflow in the EncryptedBatteryMonitor example code
when formatting the 6-digit confirmation code for display during
pairing, since the terminating null character was not accounted for in
the buffer size.
Also, there was a memory leak due to unnecessary dynamic allocation
when setting the initial value of the string characteristic.
Signed-off-by: Luca Burelli <l.burelli@arduino.cc>1 parent 6091ea6 commit 07dcca4
File tree
1 file changed
+2
-3
lines changed- examples/Peripheral/EncryptedBatteryMonitor
1 file changed
+2
-3
lines changedLines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
181 | 180 | | |
182 | 181 | | |
183 | 182 | | |
| |||
0 commit comments