Skip to content

Commit c641294

Browse files
committed
Coverity: Buffer not null terminated
1. When copying the shell, leave a byte free in the dest buffer. Fill it with a null. Fixes CID: 572891
1 parent 4700799 commit c641294

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apps/wolfsshd/wolfsshd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,8 @@ static int SHELL_Subsystem(WOLFSSHD_CONNECTION* conn, WOLFSSH* ssh,
13511351
char* cursor;
13521352
char* start;
13531353

1354-
WSTRNCPY(shell, pPasswd->pw_shell, sizeof(shell));
1354+
WSTRNCPY(shell, pPasswd->pw_shell, sizeof(shell)-1);
1355+
shell[sizeof(shell)-1] = 0;
13551356
cursor = shell;
13561357
do {
13571358
start = cursor;

0 commit comments

Comments
 (0)