qemu/libcacard
Michael Tokarev d09b8fa161 libcacard: fix wrong array expansion logic
The currrent code in libcacard/vcard_emul_nss.c:vcard_emul_options()
has a weird bug in variable usage around expanding opts->vreader
array.

There's a helper variable, vreaderOpt, which is first needlessly
initialized to NULL, next, conditionally, only we have to expand
opts->vreader, receives array expansion from g_renew(), and next,
even if we don't actually perform expansion, the value of this
variable is assigned to the actual array, opts->vreader, which
was supposed to be expanded.

So, since we expand the array by READER_STEP increments, only
once in READER_STEP (=4) the code will work, in other 3/4 times
it will fail badly.

Fix this by not using this temp variable when expanding the
array, and by dropping the useless =NULL initializer too -
if it wasn't in place initially, compiler would have warned
us about this problem at the beginning.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
2014-05-26 10:40:04 +04:00
..
cac.c libcacard: Convert two leftover realloc() to GLib 2014-05-24 00:46:20 +04:00
cac.h libcacard/vreader: add debugging messages for apdu 2013-04-24 11:48:02 +03:00
card_7816.c libcacard: g_malloc cleanups 2014-05-24 00:07:29 +04:00
card_7816.h
card_7816t.h misc: Fix some typos in names and comments 2013-09-01 18:59:24 +04:00
event.c libcacard: g_malloc cleanups 2014-05-24 00:07:29 +04:00
eventt.h
libcacard.pc.in
libcacard.syms libcacard: add list of exported symbols 2013-01-12 17:19:39 +01:00
link_test.c
Makefile libcacard: remove libcacard-specific CFLAGS and LIBS from global vars 2014-05-09 22:59:40 +02:00
vcard_emul_nss.c libcacard: fix wrong array expansion logic 2014-05-26 10:40:04 +04:00
vcard_emul_type.c
vcard_emul_type.h
vcard_emul.h
vcard.c libcacard: g_malloc cleanups 2014-05-24 00:07:29 +04:00
vcard.h
vcardt_internal.h libcacard: move atr setting from macro to function 2013-04-24 11:48:03 +03:00
vcardt.c libcacard: move atr setting from macro to function 2013-04-24 11:48:03 +03:00
vcardt.h libcacard: move atr setting from macro to function 2013-04-24 11:48:03 +03:00
vevent.h
vreader.c libcacard/vreader: Tighten assertion to clarify intent 2014-05-24 00:46:11 +04:00
vreader.h
vreadert.h
vscard_common.h
vscclient.c libcacard: Plug memory leaks around vreader_get_reader_list() 2014-05-24 00:45:57 +04:00