Skip to content

Commit 5b68cdc

Browse files
Fix compilation warning on linux
1 parent 0f47a27 commit 5b68cdc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/modules/users.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void ffPrintUsers(FFinstance* instance)
2020
setutxent();
2121

2222
FFlist users;
23-
ffListInit(&users, sizeof(n->ut_user));
23+
ffListInit(&users, sizeof(n->ut_user) + 1);
2424

2525
next:
2626
while((n = getutxent()))
@@ -32,7 +32,10 @@ void ffPrintUsers(FFinstance* instance)
3232
if(strcmp((const char*)ffListGet(&users, i), n->ut_user) == 0)
3333
goto next;
3434
}
35-
strcpy((char*)ffListAdd(&users), n->ut_user);
35+
36+
char* dest = ffListAdd(&users);
37+
strncpy(dest, n->ut_user, sizeof(n->ut_user));
38+
dest[sizeof(n->ut_user)] = '\0';
3639
}
3740
}
3841

0 commit comments

Comments
 (0)