getnetgrent.c (20957) | getnetgrent.c (23668) |
---|---|
1/* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) | 1/* 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 37#if defined(LIBC_SCCS) && !defined(lint) |
38static char sccsid[] = "@(#)getnetgrent.c 8.1 (Berkeley) 6/4/93"; | 38static char sccsid[] = "@(#)getnetgrent.c 8.2 (Berkeley) 4/27/95"; |
39#endif /* LIBC_SCCS and not lint */ 40 41#include <stdio.h> 42#include <strings.h> 43#include <stdlib.h> 44#include <unistd.h> 45 46#ifdef YP --- 431 unchanged lines hidden (view full) --- 478 grp->ng_str[NG_DOM] == NULL ? "" : grp->ng_str[NG_DOM], 479 lp->l_groupname); 480#endif 481 } else { 482 spos = strsep(&pos, ", \t"); 483 if (parse_netgrp(spos)) 484 continue; 485 } | 39#endif /* LIBC_SCCS and not lint */ 40 41#include <stdio.h> 42#include <strings.h> 43#include <stdlib.h> 44#include <unistd.h> 45 46#ifdef YP --- 431 unchanged lines hidden (view full) --- 478 grp->ng_str[NG_DOM] == NULL ? "" : grp->ng_str[NG_DOM], 479 lp->l_groupname); 480#endif 481 } else { 482 spos = strsep(&pos, ", \t"); 483 if (parse_netgrp(spos)) 484 continue; 485 } |
486 /* Watch for null pointer dereferences, dammit! */ 487 if (pos != NULL) 488 while (*pos == ' ' || *pos == ',' || *pos == '\t') 489 pos++; | 486 if (pos == NULL) 487 break; 488 while (*pos == ' ' || *pos == ',' || *pos == '\t') 489 pos++; |
490 } 491 return (0); 492} 493 494/* 495 * Read the netgroup file and save lines until the line for the netgroup 496 * is found. Return 1 if eof is encountered. 497 */ --- 114 unchanged lines hidden --- | 490 } 491 return (0); 492} 493 494/* 495 * Read the netgroup file and save lines until the line for the netgroup 496 * is found. Return 1 if eof is encountered. 497 */ --- 114 unchanged lines hidden --- |