[FIX] #204782 【KVE】peony-extensions KVE-2023-1201

This commit is contained in:
Yue-Lan 2023-12-07 11:19:14 +08:00
parent 09921eb6e3
commit ea87b8454c
1 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,8 @@
#include <syslog.h>
#include <QFile>
#include <pwd.h>
class SambaConfigPrivate
{
public:
@ -334,6 +336,20 @@ bool SambaConfig::init(QString name, int pid, int uid)
return false;
}
// KVE-2023-1201
if (name.contains("|"))
return false;
QStringList allUsers;
struct passwd *pw;
setpwent();
while ((pw = getpwent()) != nullptr) {
allUsers << pw->pw_name;
}
endpwent();
if (!allUsers.contains(name)) {
return false;
}
if (d->mLock.tryLock(300)) {
d->mUserName = name;
d->mUserPid = pid;