Andrae Muys wrote:
>
> Josh Green wrote:
> > while(feof(fp) != 1)
> > {
> > fscanf(fp, "%s", temp);
> > list = g_list_append(list, g_strdup (temp));
> > }
> >
> > That should do the trick. Keep in mind that g_strdup allocates space for
> > each string, therefore these strings should be freed when not being used
> > anymore.
>
> Agreed. Some good news and some bad news.
>
> Bad News: There is a buffer overflow in the fscanf(...) statement.
> "temp" is a fixed length buffer, %s is unbounded. You should either
> specify a maximum length [fscanf(fp, "%Ns", temp); where temp is N+1
> bytes long].
>
Yes, I also noticed the buffer overflow, but thought that mentioning it
would just complicate things :) Besides, who cares about buffer
overflows unless you're writing a program that needs to run as SUID root
or is a networking server program of some sort.
Josh Green
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel