aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-05-13 02:17:09 +0000
committerBruce Momjian <bruce@momjian.us>2001-05-13 02:17:09 +0000
commit5ee76ac8c070037b311a960d8231e02f75d0c134 (patch)
tree35d423985bd8ac11ca16e86ce7334077c6437b33
parent904ba3ff69e1402bc2042807fd1d37f8570bfea1 (diff)
downloadpostgresql-5ee76ac8c070037b311a960d8231e02f75d0c134.tar.gz
postgresql-5ee76ac8c070037b311a960d8231e02f75d0c134.zip
> I've been experimenting with pgcrypto 0.3 (distributed with
> Postgres 7.1.0), and I think I've found a bug. > > I compiled Pgcrypto with OpenSSL, using gcc 2.95.4 and > OpenSSL 0.9.6a (the latest Debian 'unstable' packages). > web=> select encode(digest('blah', 'sha1'), 'base64'); > FATAL 1: pg_encode: overflow, encode estimate too small > pqReadData() -- backend closed the channel unexpectedly. > This probably means the backend terminated abnormally > before or while processing the request. > The connection to the server was lost. Attempting reset: Succeeded. > Is this a bug? Can it be fixed? This is a bug alright. And a silly one :) Marko Kreen
-rw-r--r--contrib/pgcrypto/encode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/pgcrypto/encode.c b/contrib/pgcrypto/encode.c
index b6db217c836..7a575dacd14 100644
--- a/contrib/pgcrypto/encode.c
+++ b/contrib/pgcrypto/encode.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: encode.c,v 1.4 2001/03/22 03:59:10 momjian Exp $
+ * $Id: encode.c,v 1.5 2001/05/13 02:17:09 momjian Exp $
*/
#include "postgres.h"
@@ -349,7 +349,7 @@ hex_dec_len(uint srclen)
uint
b64_enc_len(uint srclen)
{
- return srclen + (srclen / 3) + (srclen / (76 / 2));
+ return srclen + (srclen + 2 / 3) + (srclen / (76 / 2)) + 2;
}
uint