From: Martin Mares Date: Thu, 27 Jan 2022 11:02:27 +0000 (+0100) Subject: Do not crash when run with argc == 0 X-Git-Tag: v1.3~3 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=c4f895d86b2359206afb8ab0acfc0f748de95eb8;p=suidgw.git Do not crash when run with argc == 0 --- diff --git a/suidgw.c b/suidgw.c index 47885f6..43e3394 100644 --- a/suidgw.c +++ b/suidgw.c @@ -1,7 +1,7 @@ /* * A simple gateway for set-uid scripts * - * (c) 2013 Martin Mares + * (c) 2013-2022 Martin Mares */ #undef DEBUG @@ -85,6 +85,9 @@ static void sanitize_env(void) static void get_script_name(const char *arg0) { + if (!arg0) + die("Program name must be given"); + // If arg0 is a path, extract the last component const char *p = strrchr(arg0, '/'); if (p)