NetBSD Problem Report #595

From gnats  Mon Nov 28 22:42:19 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id WAA06245 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 28 Nov 1994 22:42:18 -0800
Message-Id: <199411290642.BAA02349@CHUQ.FAC.CS.CMU.EDU>
Date: Tue, 29 Nov 1994 01:42:17 -0500
From: chs@cs.cmu.edu
Reply-To: chs@cs.cmu.edu
To: gnats-bugs@NetBSD.ORG
Subject: rpc.bootparamd leaks FILE *'s.
X-Send-Pr-Version: 3.2

>Number:         595
>Category:       bin
>Synopsis:       missing fclose() in rpc.bootparamd
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 28 22:50:02 +0000 1994
>Closed-Date:    Thu Dec 08 23:19:05 +0000 1994
>Last-Modified:  
>Originator:     Chuck Silvers
>Release:        1.0
>Organization:
CMU
>Environment:
System: NetBSD chuq.fac.cs.cmu.edu 1.0 NetBSD 1.0 (SPARC) #39: Fri Nov 18 02:33:07 EST 1994 chs@chuq.fac.cs.cmu.edu:/usr/src/sys/arch/sparc/compile/SPARC sparc


>Description:

In lookup_bootparam() in usr.sbin/rpc.bootparamd/bootparamd.c,
if "id" is NULL, the function returns without fclose()ing the bootparams file.

>How-To-Repeat:

Make enough bootparam requests and eventually it should stop giving
answers.  For me, it just dumped core once it hit the fopen() bug
that I just reported before this one.

>Fix:

*** bootparamd.c.orig	Tue Nov 29 01:38:12 1994
--- /usr/src/usr.sbin/rpc.bootparamd/bootparamd.c	Mon Nov 28 00:55:10 1994
***************
*** 351,358 ****
  			strncpy(client_canonical, word, MAX_MACHINE_NAME);

  		/* We have found a line for CLIENT */
! 		if (id == NULL)
  			return 0;

  		/* Look for a value for the parameter named by ID */
  		while ((word = strsep(&bp, " \t\n")) != NULL) {
--- 351,360 ----
  			strncpy(client_canonical, word, MAX_MACHINE_NAME);

  		/* We have found a line for CLIENT */
! 		if (id == NULL) {
! 			fclose(f);
  			return 0;
+ 		}

  		/* Look for a value for the parameter named by ID */
  		while ((word = strsep(&bp, " \t\n")) != NULL) {
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: cgd 
State-Changed-When: Thu Dec 8 15:19:05 PST 1994 
State-Changed-Why:  
"hmm.  maybe adam should have changed the bug status when he fixed the bug." 
(glass fixed bug before 12/1.) 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.