aboutsummaryrefslogtreecommitdiff
path: root/src/apps/cs2cs.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2022-02-21 16:37:40 +0100
committerGitHub <noreply@github.com>2022-02-21 16:37:40 +0100
commit906edb9584efcffc4c4572325dc93f8330c39e28 (patch)
treeec59d181e9b98c34c745bbe15c6073515d9f8fea /src/apps/cs2cs.cpp
parent524b76f2e9f4bb8e4a8d2a4287c23e67c67fce07 (diff)
parent61249e6606513295b9ba5ad9a42cbb3601694d13 (diff)
downloadPROJ-906edb9584efcffc4c4572325dc93f8330c39e28.tar.gz
PROJ-906edb9584efcffc4c4572325dc93f8330c39e28.zip
Merge pull request #3070 from rouault/fix_crash_on_argc_0
Fix nullptr dereference in utilities when argv[0] == NULL
Diffstat (limited to 'src/apps/cs2cs.cpp')
-rw-r--r--src/apps/cs2cs.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/apps/cs2cs.cpp b/src/apps/cs2cs.cpp
index 03fd4dba..a8e152a7 100644
--- a/src/apps/cs2cs.cpp
+++ b/src/apps/cs2cs.cpp
@@ -346,6 +346,10 @@ int main(int argc, char **argv) {
int have_to_flag = 0, inverse = 0;
int use_env_locale = 0;
+ if( argc == 0 ) {
+ exit(1);
+ }
+
/* This is just to check that pj_init() is locale-safe */
/* Used by nad/testvarious */
if (getenv("PROJ_USE_ENV_LOCALE") != nullptr)