From 02480f906a9f44a3511172785e65e7e4127281ce Mon Sep 17 00:00:00 2001 From: philsmd Date: Wed, 15 Feb 2017 11:33:52 +0100 Subject: [PATCH] prevent buffer overflow in case of OPTS_TYPE_ST_ADD80 and/or OPTS_TYPE_ST_ADD01 --- src/interface.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/interface.c b/src/interface.c index e3fd78889..9fce09f16 100644 --- a/src/interface.c +++ b/src/interface.c @@ -2109,11 +2109,15 @@ static u32 parse_and_store_salt (u8 *out, u8 *in, u32 salt_len, MAYBE_UNUSED con if (hashconfig->opts_type & OPTS_TYPE_ST_ADD80) { + if (len >= 256) return UINT_MAX; + tmp[len++] = 0x80; } if (hashconfig->opts_type & OPTS_TYPE_ST_ADD01) { + if (len >= 256) return UINT_MAX; + tmp[len++] = 0x01; }