diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-03-02 00:16:40 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-03-02 00:16:40 +0100 |
commit | a1a15422375ad417f3d38acc7b1cff22cb17f870 (patch) | |
tree | ff7607b29e13ea08147021e730bf95a604ab197d /lib/gnutls_errors.c | |
parent | fc1221e77b5378119e811725378b53b5ba96d84d (diff) | |
download | gnutls-a1a15422375ad417f3d38acc7b1cff22cb17f870.tar.gz |
Fixes and memory leak elimination in SRP authentication.
Diffstat (limited to 'lib/gnutls_errors.c')
-rw-r--r-- | lib/gnutls_errors.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c index 85542ef4e5..c70b3bfdbe 100644 --- a/lib/gnutls_errors.c +++ b/lib/gnutls_errors.c @@ -502,11 +502,13 @@ _gnutls_mpi_log (const char *prefix, bigint_t a) char *hexbuf; int res; + if (_gnutls_log_level < 2) return; + res = _gnutls_mpi_print (a, NULL, &binlen); - if (res != 0) + if (res < 0 && res != GNUTLS_E_SHORT_MEMORY_BUFFER) { gnutls_assert (); - _gnutls_hard_log ("MPI: can't print value (%d/%d)\n", res, + _gnutls_hard_log ("MPI: %s can't print value (%d/%d)\n", prefix, res, (int) binlen); return; } @@ -514,7 +516,7 @@ _gnutls_mpi_log (const char *prefix, bigint_t a) if (binlen > 1024 * 1024) { gnutls_assert (); - _gnutls_hard_log ("MPI: too large mpi (%d)\n", (int) binlen); + _gnutls_hard_log ("MPI: %s too large mpi (%d)\n", prefix, (int) binlen); return; } @@ -522,7 +524,7 @@ _gnutls_mpi_log (const char *prefix, bigint_t a) if (!binbuf) { gnutls_assert (); - _gnutls_hard_log ("MPI: out of memory (%d)\n", (int) binlen); + _gnutls_hard_log ("MPI: %s out of memory (%d)\n", prefix, (int) binlen); return; } @@ -530,7 +532,7 @@ _gnutls_mpi_log (const char *prefix, bigint_t a) if (res != 0) { gnutls_assert (); - _gnutls_hard_log ("MPI: can't print value (%d/%d)\n", res, + _gnutls_hard_log ("MPI: %s can't print value (%d/%d)\n", prefix, res, (int) binlen); gnutls_free (binbuf); return; @@ -542,7 +544,7 @@ _gnutls_mpi_log (const char *prefix, bigint_t a) if (!hexbuf) { gnutls_assert (); - _gnutls_hard_log ("MPI: out of memory (hex %d)\n", (int) hexlen); + _gnutls_hard_log ("MPI: %s out of memory (hex %d)\n", prefix, (int) hexlen); gnutls_free (binbuf); return; } |