"Iván Matellanes" matellanesivan@gmail.com writes:
{
- MSVCRT_size_t ret;
- MSVCRT__lock_file(stream);
- ret = MSVCRT__fread_nolock_s(buf, buf_size, elem_size, count, stream);
- MSVCRT__unlock_file(stream);
The parameter validation has to be done before locking the file.
On 31/10/14 07:46, Alexandre Julliard wrote:
"Iván Matellanes" matellanesivan@gmail.com writes:
{
- MSVCRT_size_t ret;
- MSVCRT__lock_file(stream);
- ret = MSVCRT__fread_nolock_s(buf, buf_size, elem_size, count, stream);
- MSVCRT__unlock_file(stream);
The parameter validation has to be done before locking the file.
Hi, thanks for the comment. Should all parameters be validated, or just stream != NULL? Validating the rest seems redundant to me.
Regards, Iván.
"Iván Matellanes" matellanesivan@gmail.com writes:
On 31/10/14 07:46, Alexandre Julliard wrote:
"Iván Matellanes" matellanesivan@gmail.com writes:
{
- MSVCRT_size_t ret;
- MSVCRT__lock_file(stream);
- ret = MSVCRT__fread_nolock_s(buf, buf_size, elem_size, count, stream);
- MSVCRT__unlock_file(stream);
The parameter validation has to be done before locking the file.
Hi, thanks for the comment. Should all parameters be validated, or just stream != NULL? Validating the rest seems redundant to me.
I suspect you don't want to call the _s function here at all, since you could then potentially call the invalid parameter handler with the file locked. A few more tests for the error cases would probably be useful.