pubkey.c (meth__pss_encode): Fix the buffer allocation.
[catacomb-python] / pubkey.c
index 0abb011..94cb7f3 100644 (file)
--- a/pubkey.c
+++ b/pubkey.c
@@ -1099,7 +1099,7 @@ static PyObject *meth__pss_encode(PyObject *me,
                                   convszt, &p.ssz,
                                   convgrand, &p.r))
     goto end;
-  sz = (nbits + 7)/8;
+  sz = (nbits + 6)/8;
   if (p.ssz == (size_t)-1) p.ssz = p.ch->hashsz;
   if (p.ch->hashsz + p.ssz + 2 > sz) VALERR("buffer underflow");
   b = xmalloc(sz);