libcacard: fix wrong array expansion logic