The function get_tag_header calls fread(buffer, ID3_HEADER, 1, file) to indicate that it absolutely needs 10 bytes to work on, but it doesn't assign the result of this call. When the file is shorter than 10 bytes, the fread call returns 0 and leaves buffer indeterminate. In these conditions, buffer should not be passed to the function get_tag_header_with_buffer, which would find itself processing indeterminate data.
This pull request makes get_tag_header return NULL when the fread call returns 0.
The function
get_tag_header
callsfread(buffer, ID3_HEADER, 1, file)
to indicate that it absolutely needs 10 bytes to work on, but it doesn't assign the result of this call. When the file is shorter than 10 bytes, thefread
call returns 0 and leavesbuffer
indeterminate. In these conditions,buffer
should not be passed to the functionget_tag_header_with_buffer
, which would find itself processing indeterminate data.This pull request makes
get_tag_header
returnNULL
when thefread
call returns 0.