nfctype4: Fix segmentation fault on invalid access key
authorOlivier Guiter <olivier.guiter@linux.intel.com>
Mon, 17 Jun 2013 14:42:41 +0000 (16:42 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 18 Jun 2013 15:43:08 +0000 (17:43 +0200)
If length is < 0, further access to the resp buffer will cause neard to
seg fault.

plugins/nfctype4.c

index 4798f5e..1f3295b 100644 (file)
@@ -531,7 +531,7 @@ static int t4_select_file_by_name_v2(uint8_t *resp, int length, void *data)
        DBG("%d", length);
 
        if (length < 0)
-               t4_cookie_release(length, cookie);
+               return t4_cookie_release(length, cookie);
 
        /* Check for APDU error - Not found */
        if (APDU_STATUS(resp + STATUS_WORD_1) == APDU_NOT_FOUND) {