[Prev][Next][Index]

Re: Bug in SgSymbol constructor



Here is the code for fixing the bug:

in lib/newsrc/low_level.c, function newSymbol, replace:

<   str = (char *) xmalloc(strlen(name) +1);
<   strcpy(str,name);

by:

>   if(name){
>     str = (char *) xmalloc(strlen(name) +1);
>     strcpy(str,name);
>     }
>   else str=NULL;


In lib/oldsrc/writenodes.c, function write_string, replace:

<       l1 = strlen(str);

by:

>         if(!str) l1 = 0;
>       else l1 = strlen(str);

                                                   --Beata