pts: Fix stringop-overflow warnings 69/14769/4
authorMichael Meffie <mmeffie@sinenomine.net>
Mon, 23 Aug 2021 23:43:45 +0000 (19:43 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 7 Sep 2021 01:50:26 +0000 (21:50 -0400)
commita3aac5106beddc5a6f7a09c2d21c2524342aca01
tree7aa160b15999264a60764822712ed8c2d4d0c1b8
parent7924aecf95bf4918a485a041f2426bd1fa407ac8
pts: Fix stringop-overflow warnings

The ptutil functions are defined to accept bounded character arrays for
user and group names. As of GCC 11, callers which provide the names as
string literals now trigger the stringop-overflow warning, since the
regions provided by the string literals are smaller than the bounded
areas.

    error: ‘pr_ChangeEntry’ accessing 64 bytes in a region of size 1
           [-Werror=stringop-overflow=]
    note: referencing argument 4 of type ‘char *’

    error: ‘pr_IsAMemberOf’ accessing 64 bytes in a region of size 22
           [-Werror=stringop-overflow=]
    note: referencing argument 2 of type ‘char *’

    error: ‘pr_CreateUser’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

    error: ‘pr_Delete’ accessing 64 bytes in a region of size 16
           [-Werror=stringop-overflow=]
    note: referencing argument 1 of type ‘char *’

Update the callers in pts and testpt which pass literal strings. Instead
of passing char pointers to literal strings, assign the strings to
prname buffers and pass the prname buffers to the pr utility functions.

Change-Id: I7d8c67aa28d21bb6889ef92a2193a77b54c83cb1
Reviewed-on: https://gerrit.openafs.org/14769
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/ptserver/pts.c
src/ptserver/testpt.c