Commit 2057c1e
authored
fix(SECFIND-513): prevent NEXT_NOTE_ID to wrap around (#183)
Prevent NEXT_NOTE_ID to wrap around by using a checked addition instead
of an unchecked one. If the checked addition fails, then creating a new
note simply fails, making the approach safe so that no data is lost.
The overflow issue does not affect [the respective Motoko
code](https://github.com/dfinity/vetkeys/blob/main/examples/encrypted_notes_dapp_vetkd/motoko/backend/main.mo#L135),
because `nextNoteId` is of type `Nat` which has [infinite
precision](https://internetcomputer.org/docs/motoko/base/Nat).1 parent 9cad577 commit 2057c1e
1 file changed
Lines changed: 5 additions & 1 deletion
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
279 | 283 | | |
280 | | - | |
| 284 | + | |
281 | 285 | | |
282 | 286 | | |
283 | 287 | | |
| |||
0 commit comments