NetBSD Problem Report #47318

From www@NetBSD.org  Thu Dec 13 12:23:18 2012
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id D934463E33E
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 Dec 2012 12:23:17 +0000 (UTC)
Message-Id: <20121213122317.397E563E33E@www.NetBSD.org>
Date: Thu, 13 Dec 2012 12:23:17 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Replace (r)index with str(r)chr in inetd.c
X-Send-Pr-Version: www-1.0

>Number:         47318
>Category:       bin
>Synopsis:       Replace (r)index with str(r)chr in inetd.c
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:25:00 +0000 2012
>Closed-Date:    Thu Dec 13 21:54:28 +0000 2012
>Last-Modified:  Thu Dec 13 21:54:28 +0000 2012
>Originator:     Henning Petersen
>Release:        
>Organization:
>Environment:
>Description:
Replace (r)index() with str(r)chr() in inetd.c .
>How-To-Repeat:

>Fix:
diff -u -p -r1.120 inetd.c
--- usr.sbin/inetd/inetd.c	4 Jan 2012 16:09:43 -0000	1.120
+++ usr.sbin/inetd/inetd.c	6 Dec 2012 10:39:08 -0000
@@ -1367,18 +1367,18 @@ more:
 		sep->se_socktype = SOCK_STREAM;

 		/* one and only one accept filter */
-		accf = index(arg, ':');	
+		accf = strchr(arg, ':');	
 		if (accf) {
-	    		if (accf != rindex(arg, ':') ||	/* more than one */
+	    		if (accf != strrchr(arg, ':') || /* more than one */
 	    		    *(accf + 1) == '\0') {	/* nothing beyond */
 				sep->se_socktype = -1;
 			} else {
 				accf++;			/* skip delimiter */
 				strncpy(sep->se_accf.af_name, accf,
 					sizeof(sep->se_accf.af_name));
-				accf_arg = index(accf, ',');
+				accf_arg = strchr(accf, ',');
 				if (accf_arg) {	/* zero or one arg, no more */
-					if ((rindex(accf, ',') != accf_arg)) {
+					if ((strrchr(accf, ',') != accf_arg)) {
 						sep->se_socktype = -1;
 					} else {
 						accf_arg++;

>Release-Note:

>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47318 CVS commit: src/usr.sbin/inetd
Date: Thu, 13 Dec 2012 14:38:41 -0500

 Module Name:	src
 Committed By:	christos
 Date:		Thu Dec 13 19:38:41 UTC 2012

 Modified Files:
 	src/usr.sbin/inetd: inetd.c

 Log Message:
 PR/47318: Henning Petersen: Replace (r)index with str(r)chr in inetd.c
 And while here strncpy with strlcpy


 To generate a diff of this commit:
 cvs rdiff -u -r1.120 -r1.121 src/usr.sbin/inetd/inetd.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Thu, 13 Dec 2012 21:54:28 +0000
State-Changed-Why:
christos committed it, thanks!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.