As of a recent SVN HEAD, `d.legend' uses a static buffer to
        store the value of the `map' option.  It's therefore impossible
        to pass raster names more than 63 bytes long to `d.legend'.
        Since I don't see why a static buffer may be necessary here, I
        suggest the following (yet untested) patch.

diff --git a/display/d.legend/main.c b/display/d.legend/main.c
index d827d04..324012d 100644
--- a/display/d.legend/main.c
+++ b/display/d.legend/main.c
@@ -39,7 +39,7 @@ int main( int argc, char **argv )
 {
        char *mapset ;
        char buff[512];
-       char map_name[64] ;
+       const char *map_name;
        char window_name[64] ;
        int black ;
        int cats_num ;
@@ -188,7 +188,7 @@ int main( int argc, char **argv )
        if (G_parser(argc, argv))
                exit(EXIT_FAILURE);
 
-       strcpy(map_name, opt1->answer) ;
+       map_name = opt1->answer;
 
         hide_catstr = hidestr->answer;  /* note hide_catstr gets changed and 
re-read below */
         hide_catnum = hidenum->answer;

PS.  I've seen a number of other uses of static buffers scattered across
        the code, leading to both potential limits and crashes, which
        I'm on the way to investigate.

_______________________________________________
grass-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to