Skip to content
  • Nick Mathewson's avatar
    Check maximum properly in crypto_rand_int() · 5afab5ca
    Nick Mathewson authored
    George Kadianakis notes that if you give crypto_rand_int() a value
    above INT_MAX, it can return a negative number, which is not what
    the documentation would imply.
    
    The simple solution is to assert that the input is in [1,INT_MAX+1].
    If in the future we need a random-value function that can return
    values up to UINT_MAX, we can add one.
    
    Fixes bug 3306; bugfix on 0.2.2pre14.
    5afab5ca