summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-03-31 13:01:55 +0200
committerAndreas Kling <kling@serenityos.org>2020-03-31 13:02:05 +0200
commit297e6625f30a4145ec08c11d2efa875945bc4150 (patch)
treebe9f745f40dcec9ba91e009478cc0b3b65efbb3f
parentb2b5da8a179603740dca238af8eaf2348cf9a889 (diff)
downloadserenity-297e6625f30a4145ec08c11d2efa875945bc4150.zip
Browser: Refuse to run as root
-rw-r--r--Applications/Browser/main.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Applications/Browser/main.cpp b/Applications/Browser/main.cpp
index 25f01f5755..71f5cbfa45 100644
--- a/Applications/Browser/main.cpp
+++ b/Applications/Browser/main.cpp
@@ -62,6 +62,11 @@ static String s_title = "";
int main(int argc, char** argv)
{
+ if (getuid() == 0) {
+ fprintf(stderr, "Refusing to run as root\n");
+ return 1;
+ }
+
if (pledge("stdio shared_buffer accept unix cpath rpath wpath fattr", nullptr) < 0) {
perror("pledge");
return 1;