Skip to content

Commit

Permalink
Kernel/aarch64: Add implementations for safe_memset and safe_strnlen
Browse files Browse the repository at this point in the history
They currently do not actually implement a safe memset or safe strnlen,
but this initial implementation works fine for now.
  • Loading branch information
FireFox317 authored and gmta committed Feb 15, 2023
1 parent d1eec20 commit a98c0c3
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Kernel/Arch/aarch64/SafeMem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@

namespace Kernel {

bool safe_memset(void*, int, size_t, void*&)
bool safe_memset(void* dest_ptr, int c, size_t n, void*&)
{
TODO_AARCH64();
return false;
// FIXME: Actually implement a safe memset.
memset(dest_ptr, c, n);
return true;
}

ssize_t safe_strnlen(char const*, unsigned long, void*&)
ssize_t safe_strnlen(char const* str, unsigned long max_n, void*&)
{
TODO_AARCH64();
return 0;
// FIXME: Actually implement a safe strnlen.
return strnlen(str, max_n);
}

bool safe_memcpy(void* dest_ptr, void const* src_ptr, unsigned long n, void*&)
Expand Down

0 comments on commit a98c0c3

Please sign in to comment.