Fix wrong numbers being passed as string lengths

This resolves https://github.com/openssl/openssl/issues/43 and one more similar problem outlined in http://www.viva64.com/en/b/0250/