s4:dsdb: Fix size types in audit_log
authorAndreas Schneider <asn@samba.org>
Fri, 18 Jan 2019 15:16:05 +0000 (16:16 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Sat, 19 Jan 2019 11:24:18 +0000 (12:24 +0100)
audit_log.c:878:7: error: assuming signed overflow does not occur when
simplifying conditional to constant [-Werror=strict-overflow]

Signed-off-by: Andreas Schneider <asn@samba.org>
source4/dsdb/samdb/ldb_modules/audit_log.c

index 5d6ebc1e16539cbb8c2dc48997f97a88a0526995..28d824acfff3d4daa9f55c1fa64447cef04b42ed 100644 (file)
@@ -829,7 +829,7 @@ static char *log_attributes(
        enum ldb_request_type operation,
        const struct ldb_message *message)
 {
-       int i, j;
+       size_t i, j;
        for (i=0;i<message->num_elements;i++) {
                if (i > 0) {
                        buffer = talloc_asprintf_append_buffer(buffer, " ");
@@ -840,7 +840,7 @@ static char *log_attributes(
                                ldb,
                                LDB_DEBUG_ERROR,
                                "Error: Invalid element name (NULL) at "
-                               "position %d", i);
+                               "position %zu", i);
                        return NULL;
                }
 
@@ -874,7 +874,7 @@ static char *log_attributes(
                for (j=0;j<message->elements[i].num_values;j++) {
                        struct ldb_val v;
                        bool use_b64_encode = false;
-                       int length;
+                       size_t length;
                        if (j > 0) {
                                buffer = talloc_asprintf_append_buffer(
                                        buffer,
@@ -898,8 +898,8 @@ static char *log_attributes(
                                buffer = talloc_asprintf_append_buffer(
                                        buffer,
                                        "[%*.*s%s]",
-                                       length,
-                                       length,
+                                       (int)length,
+                                       (int)length,
                                        (char *)v.data,
                                        (v.length > MAX_LENGTH ? "..." : ""));
                        }