4 Commits

Author SHA1 Message Date
Romuald Conty
290a075956 Bump version to 0.10.7 2013-12-06 15:30:30 +01:00
Romuald Conty
2fa70fb3d3 Use bzip2 instead of gzip compression algorithm 2013-12-06 15:25:56 +01:00
Romuald Conty
e1a2b0225f Check if nfc_init() returns a valid context
This fixes a potential segfault when libnfc is not correctly initialized
2013-12-06 15:24:08 +01:00
Romuald Conty
222ba1838c Display right message when no tag is detected
This fixes a potential segfault due to an access to uninitialised memory variable access
2013-12-06 15:22:42 +01:00
2 changed files with 11 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
AC_INIT([mfoc],[0.10.6],[mifare@nethemba.com])
AC_INIT([mfoc],[0.10.7],[mifare@nethemba.com])
AC_CONFIG_MACRO_DIR([m4])
@@ -8,7 +8,7 @@ AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([src/mfoc.c])
AM_INIT_AUTOMAKE
AM_INIT_AUTOMAKE(dist-bzip2 no-dist-gzip)
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

View File

@@ -204,10 +204,13 @@ int main(int argc, char *const argv[])
for (i=0;!nfc_initiator_select_passive_target(r.pdi, nm, NULL, 0, &t.nt) && i < 10; i++) zsleep (100);
*/
// mf_select_tag(r.pdi, &(t.nt));
if (nfc_initiator_select_passive_target(r.pdi, nm, NULL, 0, &t.nt) < 0) {
int tag_count;
if ((tag_count = nfc_initiator_select_passive_target(r.pdi, nm, NULL, 0, &t.nt)) < 0) {
nfc_perror(r.pdi, "nfc_initiator_select_passive_target");
goto error;
} else if (tag_count == 0) {
ERR("No tag found.");
goto error;
}
// Test if a compatible MIFARE tag is used
@@ -579,6 +582,10 @@ void mf_init(mfreader *r)
{
// Connect to the first NFC device
nfc_init(&context);
if (context == NULL) {
ERR("Unable to init libnfc (malloc)");
exit(EXIT_FAILURE);
}
r->pdi = nfc_open(context, NULL);
if (!r->pdi) {
printf("No NFC device found.\n");