gnutls_x509_crt_export2 can return values greater than 0
Description of problem:
The documentation for gnutls_x509_crt_export2 claims that
"In case of failure a negative error code will be returned, and 0 on success."
This is incorrect, as the value of _gnutls_fbase64_encode is sometimes directly returned, which is the length of the exported certificate. Specifically, 0 or greater is returned on success.
Version of gnutls used:
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Code examination. And yeah, it happened to me in some code and drove me crazy for a day - thanks.
Steps to Reproduce: