This avoids Coverity being unhappy that only lower bound was defined, well I hope
lower_bounds: Checking lower bounds of signed scalar "waiting_time" by "waiting_time > 0".
CID 1090343 (#1 of 1): Untrusted value as argument (TAINTED_SCALAR)
tainted_data: Passing tainted variable "waiting_time" to a tainted sink.
sleep(waiting_time);
nfc_exit(context); was called 2 times
CID 1090348 (#1 of 1): Use after free (USE_AFTER_FREE)53. deref_arg:
Calling "nfc_exit(nfc_context *)" dereferences freed pointer "context".
(The dereference is assumed on the basis of the 'nonnull' parameter
attribute.)
- Fixed the suppression of the auto-fixup for linking against MS built libs
- Fixed all the formatting warnings by shifting to inttypes.h specifiers
- shifted to %lu for DWORD printf
This becomes more consistent with all other pass by pointer of most structures.
Additionally, this should lessen stack memory usage, as building strings with str_nfc_target would push the target (283 bytes) plus then a copy of the info objects (up to 275) onto the stack as it dives into the sprintf functions.
Lastly, this makes my attempt at a .NET wrapper easier, as I can make passing by pointer work, but passing by value seems to bomb on the interop right now.
Fix following warnings:
[examples/pn53x-tamashell.c:162]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122_pcsc.c:261]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/acr122s.c:441]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:210]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/arygon.c:522]: (warning) scanf without field width limits can crash with huge input data
[libnfc/drivers/pn532_uart.c:187]: (warning) scanf without field width limits can crash with huge input data
[utils/nfc-relay-picc.c:176]: (warning) scanf without field width limits can crash with huge input data
Fix cppcheck warnings
[utils/nfc-read-forum-tag3.c:281]: (style) Variable 'len' is assigned a value that is never used
[utils/nfc-relay-picc.c:392]: (style) Variable 'res' is assigned a value that is never used
* in main():
** errx()/err()/return -> exit()
** return values -> EXIT_SUCCESS & EXIT_FAILURE
* out of main:
** err()/errx()/exit() -> return
** change retval from size_t to int to allow returning errors
** don't use EXIT_SUCCESS / EXIT_FAILURE as retvals
* add nfc_close() & nfc_exit() to exit() on errors
* add missing fclose() on errors
* add missing test if (pnd == NULL)
* unify style if (pnd == / != NULL)
* remove goto's
* few related fixes
* remove if(pnd!=NULL) test on nfc_close() calls
nfc-relay-picc.c:76: warning: no previous prototype for ‘intr_hdlr’
nfc-relay-picc.c:85: warning: no previous prototype for ‘print_usage’
nfc-relay-picc.c:96: warning: no previous prototype for ‘print_hex_fd4’
nfc-relay-picc.c:118: warning: no previous prototype for ‘scan_hex_fd3’
nfc-relay-picc.c: In function ‘main’:
nfc-relay-picc.c:190: warning: function declaration isn’t a prototype
- nfc_device is now an opaque type;
- PN53x specific errors are not public anymore;
- nfc_device_name() renamed to nfc_device_get_name() for the sake of consistency;
- examples/*, utils/* uses the new nfc_device_get_name() function instead of access directly to struct's content;
- new error defined: NFC_ERFTRANS for notifying about RF transmission error, its used by mifare.c to detect permissions error on mifare;
- drivers initiator_transceive_bytes() function now returns libnfc's error code on failure (<0), and received bytes count on success (>=0);
- remove some unused errors.