From 5b68cdc0dda3df2cee336cbebcaae9cc0cc10dd5 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Thu, 29 Sep 2022 15:53:28 +0200 Subject: [PATCH] Fix compilation warning on linux --- src/modules/users.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/users.c b/src/modules/users.c index c49c2570a..c1b85f8da 100644 --- a/src/modules/users.c +++ b/src/modules/users.c @@ -20,7 +20,7 @@ void ffPrintUsers(FFinstance* instance) setutxent(); FFlist users; - ffListInit(&users, sizeof(n->ut_user)); + ffListInit(&users, sizeof(n->ut_user) + 1); next: while((n = getutxent())) @@ -32,7 +32,10 @@ next: if(strcmp((const char*)ffListGet(&users, i), n->ut_user) == 0) goto next; } - strcpy((char*)ffListAdd(&users), n->ut_user); + + char* dest = ffListAdd(&users); + strncpy(dest, n->ut_user, sizeof(n->ut_user)); + dest[sizeof(n->ut_user)] = '\0'; } }