NetBSD Problem Report #415

From gnats  Mon Aug 15 12:15:02 1994
Received: from flip.informatik.tu-muenchen.de (root@flip.informatik.tu-muenchen.de [131.159.8.33]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA02146 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 15 Aug 1994 12:14:54 -0700
Message-Id: <199408151915.VAA11779@flip.informatik.tu-muenchen.de>
Date: Mon, 15 Aug 1994 21:15:38 +0200
From: grossman@informatik.tu-muenchen.de
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: Programs that access the netgroup file may crash
X-Send-Pr-Version: 3.2

>Number:         415
>Category:       lib
>Synopsis:       Programs that access the netgroup file may crash
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 15 12:20:05 +0000 1994
>Closed-Date:    Mon Sep 19 04:32:50 +0000 1994
>Last-Modified:  
>Originator:     Rolf Grossmann
>Release:        NetBSD 1.0_BETA
>Organization:
Technische Universitaet Muenchen
>Environment:
System: NetBSD flip 1.0_BETA NetBSD 1.0_BETA (TIGKI) #38: Fri Aug 12 16:44:36 MET DST 1994 grossman@flip:/usr/src/sys/arch/sparc/compile/TIGKI sparc


>Description:
	There is a bug in libc/gen/getnetgrent.c, that causes programs using
	netgroups to crash, if the file /etc/netgroup exists and contains a 
	line that references another netgroup at the and of the line. 
	(Just see the How-To-Repeat section ;))

>How-To-Repeat:
	Put this in your /etc/netgroup file:
# demonstration netgroup file (next line causes the problem)
realgroup demogroup
demogroup (host,user,dom)

	Take any program that uses netgroups (e.g. mountd) or write your
	own like:
int main()
{
        extern int setnetgrent();

        setnetgrent("realgroup");
        return 0;
}


>Fix:
	Quite easy. Here's the patch:

*** gen/getnetgrent.c.orig      Mon Aug 15 20:08:00 1994
--- gen/getnetgrent.c   Mon Aug 15 20:30:04 1994
***************
*** 249,254 ****
--- 249,256 ----
                        if (parse_netgrp(spos))
                                return (1);
                }
+               if (pos == NULL)
+                       break;
                while (*pos == ' ' || *pos == ',' || *pos == '\t')
                        pos++;
        }

	By the way: This just fixes the misbehaviour, when the syntax is
	correct. It's still possible to write an incorrect netgroup file 
	that causes programs to crash.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Sun Sep 18 21:32:50 PDT 1994 
State-Changed-Why:  
Fixed. 
>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.