diff options
author | Stefan Metzmacher <metze@samba.org> | 2021-08-04 18:03:13 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2021-11-30 15:53:34 +0000 |
commit | 600ebefa5af806f376abda722fb492895f0603ac (patch) | |
tree | e423c0850c8e951e32da01f1c72f93b8a9cffc57 | |
parent | c461b906ca5940bcf69901f973b5698e3ef75063 (diff) | |
download | samba-600ebefa5af806f376abda722fb492895f0603ac.tar.gz |
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>
-rw-r--r-- | nsswitch/libwbclient/wbc_sid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nsswitch/libwbclient/wbc_sid.c b/nsswitch/libwbclient/wbc_sid.c index e0b92bd4d34..3dfc0805767 100644 --- a/nsswitch/libwbclient/wbc_sid.c +++ b/nsswitch/libwbclient/wbc_sid.c @@ -78,7 +78,7 @@ wbcErr wbcSidToString(const struct wbcDomainSid *sid, len = wbcSidToStringBuf(sid, buf, sizeof(buf)); - if (len+1 > sizeof(buf)) { + if (len >= WBC_SID_STRING_BUFLEN) { return WBC_ERR_INVALID_SID; } |