bug-gnu-chess
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Buffer overflows


From: Lukas Geyer
Subject: Re: Buffer overflows
Date: 08 Oct 2002 15:02:27 -0400
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Common Lisp)

Lukas Geyer <address@hidden> writes:

> @@ -70,10 +70,12 @@
>     }
>  
>     /*  Okay, we read in an EPD entry  */
> -   fgets (line, 255, fp);
> +   fgets (line, 1024, fp);
>     if (!feof(fp)) 
>     {
> -      ParseEPD (line);
> +      int ret = ParseEPD (line);
> +
> +      if (ret != EPD_SUCCESS) abort();
>        if (op != 2)
>           printf ("\n%s : Best move = %s\n", id, solution);
>        return (true);

Ok, this one had still debugging code in it, the abort() should
go. Currently I have the following.

@@ -69,11 +69,15 @@
       return (false);
    }

+next_line:
    /*  Okay, we read in an EPD entry  */
-   fgets (line, 255, fp);
+   fgets (line, 1024, fp);
    if (!feof(fp))
    {
-      ParseEPD (line);
+      int ret = ParseEPD (line);
+
+      /* For now just ignore malformed lines */
+      if (ret != EPD_SUCCESS) goto next_line;
       if (op != 2)
          printf ("\n%s : Best move = %s\n", id, solution);
       return (true);

Sorry for that, but I guess you'd figur it out anyway the first time
you feed a broken EPD file to it...

Lukas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]