client.c: fix TOCTOU for file input
client.c: fix TOCTOU for file input

The function cmdline_input_from_file() allocates a chunk of memory
to hold the contents of the given file. As libcoap does not offer
an interface to realloc(), we have to determine the required buffer
size before starting to read from the file, leading to a classical
TOCTOU condition.

This change mitigates the defect by first opening the file and then
calling fstat(). Note that the subsequent fread() call takes the
size of the pre-allocated buffer into account.

authmillenon/libcoap,authmillenon/libcoap,authmillenon/libcoap