mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-07 22:22:29 -04:00
fw: Safer memory functions + asserts
Introduce memcpy_s() and wordcpy_s() that takes the destination buffer size as an argument. Use assert() which aborts our program to an eternal loop if we hit problems. Sprinkle asserts elsewhere as well. Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
f386cec1ed
commit
ccc3b16569
7 changed files with 81 additions and 23 deletions
|
@ -15,8 +15,8 @@ void htif_putinthex(const uint32_t n);
|
|||
int htif_puts(const char *s);
|
||||
void htif_hexdump(uint8_t *buf, int len);
|
||||
void *memset(void *dest, int c, unsigned n);
|
||||
void *memcpy(void *dest, const void *src, unsigned n);
|
||||
void *wordcpy(void *dest, const void *src, unsigned n);
|
||||
void memcpy_s(void *dest, size_t destsize, const void *src, size_t n);
|
||||
void wordcpy_s(void *dest, size_t destsize, const void *src, size_t n);
|
||||
int memeq(void *dest, const void *src, unsigned n);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue