mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-12 18:34:36 +08:00
When given oversized key, encrypt/decrypt corrupted
memory. This fixes it. Also a free() was missing. marko
This commit is contained in:
parent
7e16f3c0d8
commit
149d13de74
@ -26,7 +26,7 @@
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: px.c,v 1.3 2001/10/25 05:49:20 momjian Exp $
|
* $Id: px.c,v 1.4 2001/11/08 15:56:58 momjian Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <postgres.h>
|
#include <postgres.h>
|
||||||
@ -88,6 +88,8 @@ combo_init(PX_Combo * cx, const uint8 *key, uint klen,
|
|||||||
memcpy(ivbuf, iv, ivlen);
|
memcpy(ivbuf, iv, ivlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (klen > ks)
|
||||||
|
klen = ks;
|
||||||
keybuf = px_alloc(ks);
|
keybuf = px_alloc(ks);
|
||||||
memset(keybuf, 0, ks);
|
memset(keybuf, 0, ks);
|
||||||
memcpy(keybuf, key, klen);
|
memcpy(keybuf, key, klen);
|
||||||
@ -96,6 +98,7 @@ combo_init(PX_Combo * cx, const uint8 *key, uint klen,
|
|||||||
|
|
||||||
if (ivbuf)
|
if (ivbuf)
|
||||||
px_free(ivbuf);
|
px_free(ivbuf);
|
||||||
|
px_free(keybuf);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user