Hi, cedric.
The problem you described is central to the Confidential Transactions scheme (common to both Maxwell's original version and RingCT) which is solved by a technique called range proof. Here's the original CT paper (https://people.xiph.org/~greg/confidential_values.txt) that explains it, and here's an answer I posted to StackExchange (https://monero.stackexchange.com/q/3035/506) that explains it differently.
Hope it helps!