Fix memory overrun in rsa padding check functions