Fix gcc11 compiler issue "-Werror=stringop-overflow="
authorGünther Deschner <gd@samba.org>
Mon, 3 May 2021 19:27:58 +0000 (21:27 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 7 May 2021 06:23:32 +0000 (06:23 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14699

[3548/3991] Compiling source3/winbindd/winbindd_pam.c
../../source3/winbindd/winbindd_pam.c: In function ‘winbindd_dual_pam_auth_cached’:
../../source3/winbindd/winbindd_pam.c:1069:18: error: ‘winbindd_get_creds’ accessing 128 bytes in a region of size 8 [-Werror=stringop-overflow=]
 1069 |         result = winbindd_get_creds(domain,
      |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
 1070 |                                     state->mem_ctx,
      |                                     ~~~~~~~~~~~~~~~
 1071 |                                     &sid,
      |                                     ~~~~~
 1072 |                                     &my_info3,
      |                                     ~~~~~~~~~~
 1073 |                                     &cached_nt_pass,
      |                                     ~~~~~~~~~~~~~~~~
 1074 |                                     &cached_salt);
      |                                     ~~~~~~~~~~~~~
../../source3/winbindd/winbindd_pam.c:1069:18: note: referencing argument 5 of type ‘const uint8_t **’ {aka ‘const unsigned char **’}
../../source3/winbindd/winbindd_pam.c:1069:18: error: ‘winbindd_get_creds’ accessing 128 bytes in a region of size 8 [-Werror=stringop-overflow=]
../../source3/winbindd/winbindd_pam.c:1069:18: note: referencing argument 6 of type ‘const uint8_t **’ {aka ‘const unsigned char **’}
In file included from ../../source3/winbindd/winbindd.h:359,
                 from ../../source3/winbindd/winbindd_pam.c:26:
../../source3/winbindd/winbindd_proto.h:251:10: note: in a call to function ‘winbindd_get_creds’
  251 | NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
      |          ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_creds.c
source3/winbindd/winbindd_proto.h

index 2d7aacf36a9bd139e173efe00727a5979a2de25f..97262bbf87bb4a48259c94fe5009b5b586fb30d0 100644 (file)
@@ -33,8 +33,8 @@ NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
                            TALLOC_CTX *mem_ctx,
                            const struct dom_sid *sid,
                            struct netr_SamInfo3 **info3,
-                           const uint8_t *cached_nt_pass[NT_HASH_LEN],
-                           const uint8_t *cred_salt[NT_HASH_LEN])
+                           const uint8_t **cached_nt_pass,
+                           const uint8_t **cred_salt)
 {
        struct netr_SamInfo3 *info;
        NTSTATUS status;
index 04edf3489bbcaf3233526d587163059226761a7e..fec5d691dd8aa2089091d288129441aa246a32cf 100644 (file)
@@ -252,8 +252,8 @@ NTSTATUS winbindd_get_creds(struct winbindd_domain *domain,
                            TALLOC_CTX *mem_ctx,
                            const struct dom_sid *sid,
                            struct netr_SamInfo3 **info3,
-                           const uint8_t *cached_nt_pass[NT_HASH_LEN],
-                           const uint8_t *cred_salt[NT_HASH_LEN]);
+                           const uint8_t **cached_nt_pass,
+                           const uint8_t **cred_salt);
 NTSTATUS winbindd_store_creds(struct winbindd_domain *domain,
                              const char *user, 
                              const char *pass,