File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
examples/tutorials/root_of_trust/questionable_service_milestone_one Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#include <stdio.h>
8
8
#include <stdlib.h>
9
+ #include <string.h>
9
10
10
11
#include <libtock/kernel/ipc.h>
11
12
#include <libtock/tock.h>
@@ -62,12 +63,8 @@ static int setup_logging() {
62
63
static int log_to_screen (const char * message ) {
63
64
returncode_t ret ;
64
65
65
- // Copy up to the log buffer's size of the message, with room for a null byte.
66
- uint16_t len = strnlen (message , sizeof (log_buf ) - 1 );
67
- memcpy (log_buf , message , len );
68
-
69
- // Add the null byte.
70
- log_buf [len ] = '\0' ;
66
+ // Load the log buffer with our message
67
+ strlcpy (log_buf , message , LOG_WIDTH );
71
68
72
69
// Start the logging process.
73
70
ret = ipc_notify_service (screen_service );
You can’t perform that action at this time.
0 commit comments