glibc/sunrpc
Adhemerval Zanella Netto 6128e82ebe sunrpc: Suppress GCC -Os warning on user2netname
GCC with -Os warns that sprint might overflow:

  netname.c: In function ‘user2netname’:
  netname.c:51:28: error: ‘%s’ directive writing up to 255 bytes into a
  region of size between 239 and 249 [-Werror=format-overflow=]
     51 |   sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
        |                            ^~               ~~~~~~~
  netname.c:51:3: note: ‘sprintf’ output between 8 and 273 bytes into a
  destination of size 256
     51 |   sprintf (netname, "%s.%d@%s", OPSYS, uid, dfltdom);
        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

However the code does test prior the sprintf call that dfltdom plus
the required extra space for OPSYS, uid, and extra character will not
overflow and return 0 instead.

Checked on x86_64-linux-gnu and i686-linux-gnu.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
2022-10-05 18:04:13 -03:00
..
rpc
auth_des.c
auth_none.c
auth_unix.c
authdes_prot.c
authuxprot.c
clnt_gen.c
clnt_perr.c
clnt_raw.c
clnt_simp.c
clnt_tcp.c
clnt_udp.c
clnt_unix.c
create_xid.c
des_crypt.c
des_impl.c
des_soft.c
get_myaddr.c
getrpcport.c
key_call.c
key_prot.c
Makefile
netname.c
openchild.c
pm_getmaps.c
pm_getport.c
pmap_clnt.c
pmap_prot2.c
pmap_prot.c
pmap_rmt.c
publickey.c
rpc_cmsg.c
rpc_common.c
rpc_dtable.c
rpc_gethostbyname.c
rpc_prot.c
rpc_thread.c
rtime.c
svc_auth.c
svc_authux.c
svc_raw.c
svc_run.c
svc_simple.c
svc_tcp.c
svc_udp.c
svc_unix.c
svc.c
svcauth_des.c
test-rpcent.c
thrsvc.c
tst-bug22542.c
tst-bug28768.c
tst-getmyaddr.c
tst-svc_register.c
tst-udp-error.c
tst-udp-garbage.c
tst-udp-nonblocking.c
tst-udp-timeout.c
tst-xdrmem2.c
tst-xdrmem.c
Versions
xcrypt.c
xdr_array.c
xdr_float.c
xdr_intXX_t.c
xdr_mem.c
xdr_rec.c
xdr_ref.c
xdr_sizeof.c
xdr_stdio.c
xdr.c