3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 22:19:23 +01:00

ttls: clear the obtained memory to prevent info leaks

This commit is contained in:
Tim Kourt 2018-09-26 14:57:41 -07:00 committed by Denis Kenzior
parent 3d77748bca
commit 8f0c4a769a

View File

@ -58,6 +58,9 @@ struct avp_builder {
static void avp_builder_grow(struct avp_builder *builder) static void avp_builder_grow(struct avp_builder *builder)
{ {
builder->buf = l_realloc(builder->buf, builder->capacity * 2); builder->buf = l_realloc(builder->buf, builder->capacity * 2);
memset(builder->buf + builder->capacity, 0, builder->capacity);
builder->capacity *= 2; builder->capacity *= 2;
} }
@ -132,7 +135,10 @@ static struct avp_builder *avp_builder_new(size_t capacity)
return NULL; return NULL;
builder = l_new(struct avp_builder, 1); builder = l_new(struct avp_builder, 1);
builder->buf = l_malloc(capacity); builder->buf = l_malloc(capacity);
memset(builder->buf, 0, capacity);
builder->capacity = capacity; builder->capacity = capacity;
return builder; return builder;