• Philippe Teuwen's avatar
    nfc-emulate-forum-tag4: fix TOCTOU · 679897d0
    Philippe Teuwen authored
    Hopefully fix TOCTOU by calling fopen() before stat()
    At least this should prevent Coverity to complain about it:
    CID 1090346 (#1 of 1): Time of check time of use (TOCTOU)
      fs_check_call: Calling function "stat(char const *, struct stat *)" to perform check on "filename".
      toctou: Calling function "fopen(char const * restrict, char const * restrict)" that uses "filename" after a check function. This can cause a time-of-check, time-of-use race condition.
    Note that it seems pretty hard to avoid completely:
nfc-emulate-forum-tag4.c 12.7 KB