1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix log terminal write insecure copying.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-08-19 23:43:11 +02:00
parent 6cf07034d5
commit a5eacdbdcc

View file

@ -408,16 +408,16 @@ ssize_t LogTerminal::read(ioctx_t* ctx, uint8_t* userbuf, size_t count)
return sofar; return sofar;
} }
ssize_t LogTerminal::write(ioctx_t* ctx, const uint8_t* buf, size_t count) ssize_t LogTerminal::write(ioctx_t* ctx, const uint8_t* io_buffer, size_t count)
{ {
// TODO: Add support for ioctx to the kernel log. // TODO: Add support for ioctx to the kernel log.
const size_t BUFFER_SIZE = 64UL; const size_t BUFFER_SIZE = 64UL;
if ( BUFFER_SIZE < count ) if ( BUFFER_SIZE < count )
count = BUFFER_SIZE; count = BUFFER_SIZE;
char buffer[BUFFER_SIZE]; char buffer[BUFFER_SIZE];
if ( !ctx->copy_from_src(buffer, buf, count) ) if ( !ctx->copy_from_src(buffer, io_buffer, count) )
return -1; return -1;
Log::PrintData(buf, count); Log::PrintData(buffer, count);
return count; return count;
} }