You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check result of gmt_get_ext before passing to other functions (#4981)
* Check result of gmt_get_ext before passing to other functions
See #4979. The problem was we had the result of gmt_get_ext being passed directly to a strcmp function. However, this file had no extension so gmt_get_ext return NULL and that crashed the strcmp. There were two places in GMT where we did this. Now replaced by a separate check if an extensino was found. Closes#4979.
* Update gmt_esri_io.c
return (GMT_GRDIO_PIPE_CODECHECK); /* Cannot check on pipes */
358
-
if (!strcmp (gmt_get_ext (HH->name), GMT_TILE_EXTENSION_REMOTE)) return (-1); /* Watch out for .jp2 tiles since they may contain W|E|S|N codes as well and the ESRI check comes before GDAL check*/
358
+
if ((e=gmt_get_ext (HH->name)) && !strcmp (e, GMT_TILE_EXTENSION_REMOTE)) return (-1); /* Watch out for .jp2 tiles since they may contain W|E|S|N codes as well and the ESRI check comes before GDAL check*/
359
359
if ((fp=gmt_fopen (GMT, HH->name, "r")) ==NULL)
360
360
return (GMT_GRDIO_OPEN_FAILED);
361
361
if (fgets (record, GMT_BUFSIZ, fp) ==NULL) { /* Just get first line. Not using gmt_fgets since we may be reading a binary file */
0 commit comments