Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix security vulnerabilities introduced by LD_PRELOAD #240

Merged
merged 1 commit into from
Dec 7, 2023
Merged
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
6 changes: 6 additions & 0 deletions application/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ Q_LOGGING_CATEGORY(logAppMain, "org.deepin.log.viewer.main", QtInfoMsg)

int main(int argc, char *argv[])
{
// 检查是否开启预加载,防止黑客利用预加载的so库劫持日志后端服务干坏事
if (getenv("LD_PRELOAD")) {
qCritical() << "env LP_PRELOAD is illegal, please unset it.";
return -1;
}

//在root下或者非deepin/uos环境下运行不会发生异常,需要加上XDG_CURRENT_DESKTOP=Deepin环境变量;
if (!QString(qgetenv("XDG_CURRENT_DESKTOP")).toLower().startsWith("deepin")) {
setenv("XDG_CURRENT_DESKTOP", "Deepin", 1);
Expand Down