From 2cf897b10aa6b0d9565333085477e348261bfb2c Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 17 Aug 2009 20:29:11 +0200 Subject: s4: Make the int32 problem more clear - and fix another error --- source4/lib/ldb-samba/ldif_handlers.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source4/lib/ldb-samba') diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index acf8af7917b..708643011bf 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -649,6 +649,8 @@ static int ldif_canonicalise_int32(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { char *end; + /* 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 *)in->data, &end, 0); if (*end != 0) { return -1; @@ -665,6 +667,8 @@ static int ldif_canonicalise_int32(struct ldb_context *ldb, void *mem_ctx, static int ldif_comparison_int32(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *v1, const struct ldb_val *v2) { + /* We've to use "strtoll" here to have the intended overflows. + * Otherwise we may get "LONG_MAX" and the conversion is wrong. */ return (int32_t) strtoll((char *)v1->data, NULL, 0) - (int32_t) strtoll((char *)v2->data, NULL, 0); } -- cgit