]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commit
glibc: Suppress GCC -Os warning on user2netname for sunrpc
authorNikhil R <nikhilr5@kpit.com>
Tue, 4 Feb 2025 06:55:26 +0000 (07:55 +0100)
committerSteve Sakoman <steve@sakoman.com>
Mon, 10 Feb 2025 16:38:00 +0000 (08:38 -0800)
commit78fac0f623e01bd52b2ea3a597d056726deca8a4
tree2d7d9f65b3e31027a19931a27c07d2070cccc742
parent709bfb0e600148d65018db450a69de220c874efd
glibc: Suppress GCC -Os warning on user2netname for sunrpc

When building with GCC -Os, a warning is triggered indicating that sprintf might overflow.

Error:
  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.

Upstream-patch: https://github.com/bminor/glibc/commit/6128e82ebe973163d2dd614d31753c88c0c4d645

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Nikhil R <nikhilr5@kpit.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-core/glibc/glibc/0003-sunrpc-suppress-gcc-os-warning-on-user2netname.patch [new file with mode: 0644]
meta/recipes-core/glibc/glibc_2.35.bb