libwbclient: fix strict-overflow warning in wbcSidToString()
authorStefan Metzmacher <metze@samba.org>
Wed, 4 Aug 2021 16:03:13 +0000 (18:03 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 30 Nov 2021 15:53:34 +0000 (15:53 +0000)
commit600ebefa5af806f376abda722fb492895f0603ac
treee423c0850c8e951e32da01f1c72f93b8a9cffc57
parentc461b906ca5940bcf69901f973b5698e3ef75063
libwbclient: fix strict-overflow warning in wbcSidToString()

../../nsswitch/libwbclient/wbc_sid.c:83:5: error: assuming signed overflow does not occur when simplifying conditional [-Werror=strict-overflow]
  if (len+1 > sizeof(buf)) {
     ^

Even this would fail:
../../nsswitch/libwbclient/wbc_sid.c:83:5: error: assuming signed overflow does not occur when simplifying conditional [-Werror=strict-overflow]
  if (len >= sizeof(buf)) {
     ^

Note that this only seems to happen with gcc 7 and when -O3 and
-fvisibility=hidden are used together. E.g. in the opensuse151-samba-o3
builds.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14780

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
nsswitch/libwbclient/wbc_sid.c