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

Re: amiga-fdisk 0.4 and debian/potato boot floppies.



On Tue, 25 Jan 2000, Roman Hodek wrote:

> Yes, gets() is dangerous because it doesn't check the bounds of the
> input buffer. One should use fgets() instead, e.g.:
> 
> +#ifdef DONT_USE_READLINE
> +char *readline (const char *prompt)
> +{
> +       char buffer[1024];
> +       char *s;
> +       int size;
> +       printf ("%s",prompt);
> +       fflush (stdout);
> +       fgets (buffer, sizeof(buffer), stdin);
> +       size = strlen (buffer);
> +       s = malloc ((size+1)*sizeof(char));
> +       s = strcpy (s, buffer);
> +       fflush (stdin);
> +       return s;
> +}
> +#endif
> 
> This is sufficiently safe.
> 
> > So i guess best would be to have two binary package from amiga
> > fdisk, one called amiga-fdisk is to be used by everyone, the other,
> > called amiga-fdisk-boot-floppies, or something such is to be used by
> > the boot floppies folk.
> 
> Makes sense.

Isn't fdisk/amiga only used to get the partition data of the disks? In
this case, we could just make a very small version that does just this.

I like the above solution for readline. If there's no argument against it,
I will put it in and release a new version the next days.

I lost some old mails describing bugs in amiga-fdisk. If you have some
unfixed bugs left, you're welcome to tell me.

Stefan.

-- 
The reason computer chips are so small is computers don't eat much.


Reply to: