ppp icon indicating copy to clipboard operation
ppp copied to clipboard

plugins/winbind: minor file handling leak

Open yarda opened this issue 1 year ago • 1 comments

You use fdopen() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L320 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L322, but later you use close() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442. I think you should use fclose() otherwise you will probably leak few hundred bytes.

Also if the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 fails you should still try to call the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442.

yarda avatar Jun 24 '24 12:06 yarda

ppp-2.5.0

yarda avatar Jun 24 '24 12:06 yarda

You use fdopen() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L320 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L322, but later you use close() at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 and https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442. I think you should use fclose() otherwise you will probably leak few hundred bytes.

Good point. I agree.

Also if the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#L435 fails you should still try to call the close() (or fclose()) at https://github.com/ppp-project/ppp/blob/master/pppd/plugins/winbind.c#442.

Isn't that why there is the close() at line 436? (which should also be fclose())?

paulusmack avatar Jul 08 '24 10:07 paulusmack

@yarda: Have you seen the @paulusmack comment?

Neustradamus avatar Aug 17 '24 13:08 Neustradamus

I changed 3 instances of close() to fclose().

paulusmack avatar Aug 20 '24 09:08 paulusmack