mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-11 17:00:37 +00:00
Kernel: Stop supporting sprintf
The kernel no longer needs sprintf (which might, in theory, overflow), so we can hide the C++ declaration and make the function uncallable from within the kernel. However, libstdc++ still links against it, as libstdc++ uses it for demangling, from AK::demangle().
This commit is contained in:
parent
04f494fc44
commit
1aad0f8b16
Notes:
sideshowbarker
2024-07-19 03:17:02 +09:00
Author: https://github.com/BenWiederhake Commit: https://github.com/SerenityOS/serenity/commit/1aad0f8b16f Pull-request: https://github.com/SerenityOS/serenity/pull/3263
2 changed files with 4 additions and 1 deletions
|
@ -133,6 +133,10 @@ static void buffer_putch(char*& bufptr, char ch)
|
|||
*bufptr++ = ch;
|
||||
}
|
||||
|
||||
// Declare it, so that the symbol is exported, because libstdc++ uses it.
|
||||
// However, *only* libstdc++ uses it, and none of the rest of the Kernel.
|
||||
extern "C" int sprintf(char* buffer, const char* fmt, ...);
|
||||
|
||||
int sprintf(char* buffer, const char* fmt, ...)
|
||||
{
|
||||
ScopedSpinLock lock(s_log_lock);
|
||||
|
|
|
@ -33,7 +33,6 @@ int dbgprintf(const char* fmt, ...);
|
|||
int dbgputstr(const char*, int);
|
||||
int kernelputstr(const char*, int);
|
||||
int kprintf(const char* fmt, ...);
|
||||
int sprintf(char* buf, const char* fmt, ...);
|
||||
int snprintf(char* buf, size_t, const char* fmt, ...);
|
||||
void set_serial_debug(bool on_or_off);
|
||||
int get_serial_debug();
|
||||
|
|
Loading…
Reference in a new issue