From e1350cac43d5a9854207af3fb318a74be7fcd12f Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Sun, 17 Mar 2019 19:16:04 +0100 Subject: Fix some issues raised by latest cppcheck - coordinateoperation_internal.hpp: missing 'explicit' keyword - proj.cpp: unused 'generic' member in enumeration - init.cpp: useless assignment to a_orig and es_orig, because done again a few lines below. - crs.cpp: unused variable - datum.cpp: inefficient use of find() function - io.cpp: * missing 'static' qualifier for method * useles ternary test (left and right have same value) - aeqd.cpp: useless assignment of inv and fwd, snice done again a few lines below - isea.cpp: useless assignment of resolution and aperture since done again a few lines below, and with default values when params are absent - mod_ster.cpp: useless assignment of lp.lam, overriden in below code paths. - stere.cpp: false positive, but better not modify another variable than the iterator in a for() loop. --- src/apps/proj.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/apps/proj.cpp') diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 298a44e8..40fc5695 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -22,7 +22,6 @@ static PJ *Proj; static union { - PJ_UV (*generic)(PJ_UV, PJ *); PJ_XY (*fwd)(PJ_LP, PJ *); PJ_LP (*inv)(PJ_XY, PJ *); } proj; -- cgit v1.2.3 From 1eadd02ac0b28486e98aed9407f27c4956619bae Mon Sep 17 00:00:00 2001 From: Chris Mayo Date: Sun, 24 Mar 2019 11:56:35 +0000 Subject: Doc: consistently use +opt and brackets +opt represents one parameter. An ellipsis indicates additional instances of the previous parameter may be given. Spaces are used between parameters and before an ellipsis, not purely to format brackets. See man(1) SYNOPSIS conventions. --- src/apps/proj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/apps/proj.cpp') diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 40fc5695..5f0ee71f 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -45,7 +45,7 @@ static char oform_buffer[16]; /* Buffer for oform when using -d */ static const char *oterr = "*\t*", /* output line for unprojectable input */ - *usage = "%s\nusage: %s [ -bdeEfiIlmorsStTvVwW [args] ] [ +opts[=arg] ] [ files ]\n"; + *usage = "%s\nusage: %s [-bdeEfiIlmorsStTvVwW [args]] [+opt[=arg] ...] [file ...]\n"; static PJ_FACTORS facs; -- cgit v1.2.3 From 60b71b6187b6190b9ff626c8b0548789aa5c54d7 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Tue, 26 Mar 2019 14:17:31 +0100 Subject: proj/emess: fix null pointer dereference. CID 193533 --- src/apps/proj.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/apps/proj.cpp') diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 40fc5695..88074280 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -532,7 +532,7 @@ int main(int argc, char **argv) { } else { if ((fid = fopen(*eargv, "rb")) == nullptr) { - emess(-2, *eargv, "input file"); + emess(-2, "input file: %s", *eargv); continue; } emess_dat.File_name = *eargv; -- cgit v1.2.3 From 8a31ed4036888ff2039919f8c998a90cb2143bc2 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Fri, 19 Apr 2019 23:47:39 +0200 Subject: proj/cs2cs: validate value of -f parameter to avoid potential crashes (fixes #124) --- src/apps/proj.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/apps/proj.cpp') diff --git a/src/apps/proj.cpp b/src/apps/proj.cpp index 2af49c34..888d723f 100644 --- a/src/apps/proj.cpp +++ b/src/apps/proj.cpp @@ -7,6 +7,7 @@ #include #include #include "emess.h" +#include "utils.h" #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__WIN32__) # include @@ -461,6 +462,13 @@ int main(int argc, char **argv) { if (eargc == 0) /* if no specific files force sysin */ eargv[eargc++] = const_cast("-"); + if( oform ) { + if( !validate_form_string_for_numbers(oform) ) { + emess(3, "invalid format string"); + exit(0); + } + } + /* done with parameter and control input */ if (inverse && postscale) { prescale = 1; @@ -487,7 +495,6 @@ int main(int argc, char **argv) { proj.inv = pj_inv; } else proj.fwd = pj_fwd; - /* set input formatting control */ if (mon) { pj_pr_list(Proj); -- cgit v1.2.3