mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-11-24 05:33:12 -05:00
perform size checks on various operations
Signed-off-by: Tavi <tavi@divested.dev> Co-authored-by: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
This commit is contained in:
parent
5cb0ff9f4d
commit
15de34ed77
46 changed files with 1166 additions and 13 deletions
17
swab.c
Normal file
17
swab.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "musl.h"
|
||||
|
||||
/* Copied from musl libc version 1.2.5 licensed under the MIT license */
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
void musl_swab(const void *restrict _src, void *restrict _dest, ssize_t n)
|
||||
{
|
||||
const char *src = _src;
|
||||
char *dest = _dest;
|
||||
for (; n>1; n-=2) {
|
||||
dest[0] = src[1];
|
||||
dest[1] = src[0];
|
||||
dest += 2;
|
||||
src += 2;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue