Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2022 21:06:43 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: a2e41a585b3a - main - libc rpc: Fix mismatches in prototypes for array bounds.
Message-ID:  <202209282106.28SL6h4j037489@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=a2e41a585b3a8a54e09831ea476ccaa56142c1ae

commit a2e41a585b3a8a54e09831ea476ccaa56142c1ae
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-09-28 21:01:36 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-09-28 21:01:36 +0000

    libc rpc: Fix mismatches in prototypes for array bounds.
    
    Various RPC functions used a bare pointer in function prototypes to
    describe fixed-length buffer arguments but used a fixed-length array
    in the function definition.  The manual page for these functions
    describes the parameters as being fixed-length buffers, so update
    the prototypes to match the definitions.
    
    Reviewed by:    imp, emaste
    Reported by:    GCC -Warray-parameter
    Differential Revision:  https://reviews.freebsd.org/D36757
---
 include/rpc/auth.h      | 11 ++++++-----
 lib/libc/rpc/netnamer.c |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/rpc/auth.h b/include/rpc/auth.h
index bf0d76c046c6..8773e7115d12 100644
--- a/include/rpc/auth.h
+++ b/include/rpc/auth.h
@@ -279,11 +279,12 @@ __END_DECLS
  * Netname manipulation routines.
  */
 __BEGIN_DECLS
-extern int getnetname(char *);
-extern int host2netname(char *, const char *, const char *);
-extern int user2netname(char *, const uid_t, const char *);
-extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *);
-extern int netname2host(char *, char *, const int);
+extern int getnetname(char [MAXNETNAMELEN + 1]);
+extern int host2netname(char [MAXNETNAMELEN + 1], const char *, const char *);
+extern int user2netname(char [MAXNETNAMELEN + 1], const uid_t, const char *);
+extern int netname2user(char [MAXNETNAMELEN + 1], uid_t *, gid_t *, int *,
+    gid_t *);
+extern int netname2host(char [MAXNETNAMELEN + 1], char *, const int);
 extern void passwd2des ( char *, char * );
 __END_DECLS
 
diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c
index 591f6d5c91e5..8062c446dffe 100644
--- a/lib/libc/rpc/netnamer.c
+++ b/lib/libc/rpc/netnamer.c
@@ -64,7 +64,7 @@ static char    *NETID = "netid.byname";
 static char    *NETIDFILE = "/etc/netid";
 
 static int getnetid( char *, char * );
-static int _getgroups( char *, gid_t * );
+static int _getgroups( char *, gid_t [NGRPS] );
 
 /*
  * Convert network-name into unix credential



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202209282106.28SL6h4j037489>