Przeglądaj źródła

Allow parsing long GISDBASE paths (#1376)

Use a larger buffer when parsing the `.gisrc` file. Use `GPATH_MAX` to fit whatever would fit in the path value, plus the length of the key.

Fixes #1373.
Attila Oláh 4 lat temu
rodzic
commit
ca0e87bc20
1 zmienionych plików z 4 dodań i 2 usunięć
  1. 4 2
      lib/gis/env.c

+ 4 - 2
lib/gis/env.c

@@ -115,8 +115,10 @@ void G__read_gisrc_env(void)
 }
 
 static void parse_env(FILE *fd, int loc)
-{    
-    char buf[200];
+{
+    /* Account for long lines up to GPATH_MAX. 
+       E.g. "GISDBASE: GPATH_MAX\n\0" */
+    char buf[GPATH_MAX + 16];
     char *name;
     char *value;