Fix a buffer overflow in MD5 and SHA1 string calculation