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

Re: Is this a bug in libc6?



In article <[🔎] Pine.LNX.3.96.980410234938.389A-100000@Wakko.ualberta.ca>,
Jason Gunthorpe <jgg@gpu.srv.ualberta.ca> wrote:
>>         fclose(fp);
>>         fclose(fp);
>
>This is not valid. fclose's behavoir on a null fp is apparently not
>defined, but exiting with error would be prefered to faulting.

It isn't a NULL fp. It's a fp that just points to a random FILE *
in freed up memory.

>A double
>fclose is just as bad as a double free() and is not a library error should
>it fault or corrupt memory.

Indeed. If you open another file, it might happen that the struct FILE
is allocated at the same place as the previous one. And if you then
fclose(old_fp) you're really in trouble.

Mike.
-- 
 Miquel van Smoorenburg | Our vision is to speed up time,
    miquels@cistron.nl  |   eventually eliminating it.


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: