Check if source is zero-size or NULL in s2n_dup
Previously, s2n_dup did not check if the source was zero-size or NULL,
which caused s2n_map_add and s2n_map_put to leak memory.
@@ -149,6 +149,8 @@ int s2n_dup(struct s2n_blob *from, struct s2n_blob *to)
{
eq_check(to->size, 0);
eq_check(to->data, NULL);
+ ne_check(from->size, 0);
+ ne_check(from->data, NULL);
GUARD(s2n_alloc(to, from->size));
