NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/47318: Replace (r)index with str(r)chr in inetd.c



>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:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 13 12:25:00 +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++;



Home | Main Index | Thread Index | Old Index