[splint-discuss] Splint-3.1.2 bugs - Mudflap

John Carter john.carter at tait.co.nz
Wed Jul 30 19:30:55 PDT 2008


While this is a fix for the immediate problem, it is not a good fix.


> Index: src/lcllib.c
> ===================================================================
> RCS file: /cvsroot/splint/splint/src/lcllib.c,v
> retrieving revision 1.31
> diff -u -r1.31 lcllib.c
> --- src/lcllib.c	18 May 2004 19:07:47 -0000	1.31
> +++ src/lcllib.c	31 Jul 2008 01:40:55 -0000
> @@ -424,7 +424,7 @@
> }
>
> /*@constant int BUFLEN;@*/
> -# define BUFLEN 128
> +# define BUFLEN MAX_DUMP_LINE_LENGTH
>
> static bool
> loadLCDFile (FILE *f, cstring name)

The basic problem is this function ignores it "max" parameter.

char *reader_readLine (FILE *f, char *s, int max)
{
   char *res = fgets (s, MAX_DUMP_LINE_LENGTH, f);

   if (res != NULL)
     {
       if (strlen (res) == size_fromInt (MAX_DUMP_LINE_LENGTH - 1))
 	{
 	  llfatalerrorLoc (message ("Maximum line length exceeded (%d): %s", max,
 				    cstring_fromChars (s)));
 	}

       incLine ();
     }

   return res;
}




John Carter                             Phone : (64)(3) 358 6639
Tait Electronics                        Fax   : (64)(3) 359 4632
PO Box 1645 Christchurch                Email : john.carter at tait.co.nz
New Zealand



More information about the splint-discuss mailing list