diff options
Diffstat (limited to 'source4/dsdb')
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 2 | ||||
-rw-r--r-- | source4/dsdb/schema/schema_syntax.c | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 8fb639f53f..21b80dccbf 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -147,6 +147,8 @@ static struct ldb_val objectCategory_always_dn(struct ldb_module *module, TALLOC static struct ldb_val normalise_to_signed32(struct ldb_module *module, TALLOC_CTX *ctx, const struct ldb_val *val) { struct ldb_val out; + /* We've to use "strtoll" here to have the intended overflows. + * Otherwise we may get "LONG_MAX" and the conversion is wrong. */ int32_t i = (int32_t) strtoll((char *)val->data, NULL, 0); out = data_blob_string_const(talloc_asprintf(ctx, "%d", i)); return out; diff --git a/source4/dsdb/schema/schema_syntax.c b/source4/dsdb/schema/schema_syntax.c index c26b407c1f..6159ab48b1 100644 --- a/source4/dsdb/schema/schema_syntax.c +++ b/source4/dsdb/schema/schema_syntax.c @@ -234,7 +234,9 @@ static WERROR dsdb_syntax_INT32_ldb_to_drsuapi(struct ldb_context *ldb, blobs[i] = data_blob_talloc(blobs, NULL, 4); W_ERROR_HAVE_NO_MEMORY(blobs[i].data); - v = strtol((const char *)in->values[i].data, NULL, 10); + /* We've to use "strtoll" here to have the intended overflows. + * Otherwise we may get "LONG_MAX" and the conversion is wrong. */ + v = strtoll((const char *)in->values[i].data, NULL, 0); SIVALS(blobs[i].data, 0, v); } |