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

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



On Tue, Jan 25, 2000 at 08:39:13PM +0100, Stefan Reinauer wrote:
> 
> 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.

Hello, ...

If you want, i can mail you (this afternoon) a patch about it. For the debian
package, it is needed to be able to build both version one after another also,
but i can always fix it in the debian version so it works.

Also, after discution with roman, maybe a way of doing the same thing with
fgets should be more appropriate than using scanf and fflush.

And for the debian people, I modified the amiga-fdisk makefile to build
amiga-fdisk-boot-floppies, how can i manage to put it in the
amiga-fdisk-boot-floppies package ? nothing about multi binaries package was
found in the debian packaging docs i have installed on my system.

Friendly,

Sven LUTHER


Reply to: