core: prevent guaranteed memory bigger than memory size

Change-Id: I75a4b997fc4d3fe2484fa4189ec6ca1e6cf01079
Bug-Url: https://bugzilla.redhat.com/1045131
Signed-off-by: Arik Hadas <ahadas@redhat.com>