From 10398b6bd92a70be0735dbe9aa0c56503f2078ce Mon Sep 17 00:00:00 2001 From: Alexander Inyukhin Date: Sat, 19 Mar 2016 08:08:38 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=20typo=20leads=20to=20improper=20pnd->na?= =?UTF-8?q?me=20initialization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A for loop condition is always false so pnd->name is not initialized. This results in garbage when printing device name. --- libnfc/nfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 114d5e8..404786a 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -276,7 +276,7 @@ nfc_open(nfc_context *context, const nfc_connstring connstring) log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "Unable to open \"%s\".", ncs); return NULL; } - for (uint32_t i = 0; i > context->user_defined_device_count; i++) { + for (uint32_t i = 0; i < context->user_defined_device_count; i++) { if (strcmp(ncs, context->user_defined_devices[i].connstring) == 0) { // This is a device sets by user, we use the device name given by user strcpy(pnd->name, context->user_defined_devices[i].name);