Coverity issues in lapd_core/gsm mncc

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther holger at freyther.de
Fri Jul 5 17:34:58 UTC 2013


On Fri, Jul 05, 2013 at 07:43:15AM +0200, Holger Hans Peter Freyther wrote:
> Dear Andreas,

Dear Andreas,

we would also like to have your input on a mISDN file descriptor leak
in the libosmo-abis code:


src/input/misdn.c
static int _mi_e1_line_update(struct e1inp_line *line)

this function is not closing the 'sk' filedescriptor which is of type
  sk = socket(PF_ISDN, SOCK_RAW, ISDN_P_BASE);

do we need to keep this one open or is this is a bug? Pablo and me
currently do not have a mISDN setup, so we can not easily answer this
question right now.

Do you see anything wrong with this patch:

diff --git a/src/input/misdn.c b/src/input/misdn.c
index a72a21e..5966817 100644
--- a/src/input/misdn.c
+++ b/src/input/misdn.c
@@ -640,6 +640,7 @@ static int _mi_e1_line_update(struct e1inp_line *line)
        fprintf(stdout, "        nrbchan:        %d\n", devinfo.nrbchan);
        fprintf(stdout, "        name:           %s\n", devinfo.name);
 #endif
+       close(sk);
 
        if (!(devinfo.Dprotocols & (1 << ISDN_P_NT_E1))) {
                fprintf(stderr, "error: card is not of type E1 (NT-mode)\n");


thanks
	holger





More information about the OpenBSC mailing list