git: 35acd8db3484 - stable/13 - libc rpc: Fix mismatches in prototypes for array bounds.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 18:36:34 UTC
The branch stable/13 has been updated by jhb:

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

commit 35acd8db34842ee58f4d69a24948a133a31b8551
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-09-28 21:01:36 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-11 18:18:52 +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
    
    (cherry picked from commit a2e41a585b3a8a54e09831ea476ccaa56142c1ae)
---
 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