Skip to content

Commit cf05622

Browse files
dgarskedanielinux
authored andcommitted
Peer review feedback
1 parent df0ea82 commit cf05622

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/port/stm32h563/ssh_server.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ static int handle_command(const char *cmd, char *response, int max_len)
160160
if (len >= max_len)
161161
len = max_len - 1;
162162
memcpy(response, help, len);
163+
response[len] = '\0';
163164
}
164165
else if (strncmp(cmd, "info", 4) == 0) {
165166
const char *info =
@@ -171,6 +172,7 @@ static int handle_command(const char *cmd, char *response, int max_len)
171172
if (len >= max_len)
172173
len = max_len - 1;
173174
memcpy(response, info, len);
175+
response[len] = '\0';
174176
}
175177
else if (strncmp(cmd, "uptime", 6) == 0) {
176178
uint32_t uptime = ssh_server_get_uptime();
@@ -201,6 +203,7 @@ static int handle_command(const char *cmd, char *response, int max_len)
201203
if (len >= max_len)
202204
len = max_len - 1;
203205
memcpy(response, unknown, len);
206+
response[len] = '\0';
204207
}
205208
else {
206209
/* Empty command - just return prompt */

0 commit comments

Comments
 (0)