Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/plugin-authentication/operation/charamangerworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ void CharaMangerWorker::refreshDriverInfo()
{
auto driverInfo = m_charaMangerInter->driverInfo();
predefineDriverInfo(driverInfo);

auto defaultDevice = m_charaMangerInter->defaultDevice();
refreshFingerDriverStatus(defaultDevice);
}

void CharaMangerWorker::entollStart(const QString &driverName, const int &charaType, const QString &charaName)
Expand Down Expand Up @@ -412,3 +415,19 @@ void CharaMangerWorker::renameFingerItem(const QString &userName, const QString
m_charaMangerInter->RenameFinger(userName, finger, newName);
refreshFingerEnrollList(userName);
}

void CharaMangerWorker::refreshFingerDriverStatus(const QString &defaultDevice)
{
bool isFingerValid = !defaultDevice.isEmpty();
m_model->setFingerVaild(isFingerValid);

if (isFingerValid) {
struct passwd *pws;
QString userId;
pws = getpwuid(getuid());
userId = QString(pws->pw_name);
Comment on lines +427 to +428
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Potential null pointer dereference with getpwuid.

Add a null check for pws before accessing pw_name to prevent crashes if getpwuid returns nullptr.

refreshFingerEnrollList(userId);
} else {
m_model->setThumbsList(QStringList());
}
}
1 change: 1 addition & 0 deletions src/plugin-authentication/operation/charamangerworker.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public Q_SLOTS:
void stopFingerEnroll(const QString& userName);
void deleteFingerItem(const QString& userName, const QString& finger);
void renameFingerItem(const QString& userName, const QString& finger, const QString& newName);
void refreshFingerDriverStatus(const QString &defaultDevice);

private:
CharaMangerModel *m_model;
Expand Down